lkml.org 
[lkml]   [2023]   [Mar]   [23]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 2/2] leds: max597x: Add support for max597x
Hi!

> max597x is hot swap controller with indication led support.
> This driver uses DT property to configure led during boot time &
> also provide the led control in sysfs.

Can you provide dts example showing how you'll use it?

> Signed-off-by: Patrick Rudolph <patrick.rudolph@9elements.com>
> Signed-off-by: Naresh Solanki <Naresh.Solanki@9elements.com>

> +static int max597x_setup_led(struct device *dev, struct regmap *regmap, struct device_node *nc,
> + u32 reg)
> +{
...
> + ret = led_classdev_register(dev, &led->led);
> + return 0;
> +}
> +
> +static int max597x_led_probe(struct platform_device *pdev)
> +{
...
> + for_each_available_child_of_node(led_node, child) {
> + u32 reg;
> +
> + if (of_property_read_u32(child, "reg", &reg))
> + continue;
> +
> + if (reg >= MAX597X_NUM_LEDS) {
> + dev_err(&i2c->dev, "invalid LED (%u >= %d)\n", reg,
> + MAX597X_NUM_LEDS);
> + continue;
> + }
> +
> + ret = max597x_setup_led(&i2c->dev, regmap, child, reg);
> + if (ret < 0) {
> + of_node_put(child);
> + return ret;
> + }

This will cause crashes. After you successfully registered one LED,
you can't just bail out.

BR,
Pavel
--
People of Russia, stop Putin before his war on Ukraine escalates.
[unhandled content-type:application/pgp-signature]
\
 
 \ /
  Last update: 2023-03-27 01:14    [W:0.505 / U:0.064 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site