Re: [PATCH 2/2] leds: max597x: Add support for max597x

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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", &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


[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux