Messages in this thread | ![/](/images/icornerl.gif) | | Date | Thu, 23 Mar 2023 12:46:51 +0100 | From | Pavel Machek <> | Subject | Re: [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", ®)) > + 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] | ![\](/images/icornerr.gif) |