[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ZBw8K/YwrQZzt3BP@duo.ucw.cz>
Date: Thu, 23 Mar 2023 12:46:51 +0100
From: Pavel Machek <pavel@....cz>
To: Naresh Solanki <naresh.solanki@...ements.com>
Cc: Lee Jones <lee@...nel.org>,
Patrick Rudolph <patrick.rudolph@...ements.com>,
linux-kernel@...r.kernel.org, linux-leds@...r.kernel.org
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@...ements.com>
> Signed-off-by: Naresh Solanki <Naresh.Solanki@...ements.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.
Download attachment "signature.asc" of type "application/pgp-signature" (196 bytes)
Powered by blists - more mailing lists