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@xxxxxxxxxxxxx> > Signed-off-by: Naresh Solanki <Naresh.Solanki@xxxxxxxxxxxxx> > +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.
Attachment:
signature.asc
Description: PGP signature