diff options
author | Andy Shevchenko <andy.shevchenko@gmail.com> | 2021-05-29 14:19:33 +0300 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2021-09-15 10:47:33 +0300 |
commit | 0a01dc77662cfb3c15aea7cbf153c985b65cc6da (patch) | |
tree | 99892a4a8ac149a8af36419cd736eb1a1ca16be4 /drivers/leds | |
parent | e39c73563a381eefdc283ac797f40da4583b1d30 (diff) | |
download | linux-0a01dc77662cfb3c15aea7cbf153c985b65cc6da.tar.xz |
leds: lt3593: Put fwnode in any case during ->probe()
[ Upstream commit 7e1baaaa2407a642ea19b58e214fab9a69cda1d7 ]
device_get_next_child_node() bumps a reference counting of a returned variable.
We have to balance it whenever we return to the caller.
Fixes: 8cd7d6daba93 ("leds: lt3593: Add device tree probing glue")
Cc: Daniel Mack <daniel@zonque.org>
Signed-off-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Signed-off-by: Pavel Machek <pavel@ucw.cz>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'drivers/leds')
-rw-r--r-- | drivers/leds/leds-lt3593.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/drivers/leds/leds-lt3593.c b/drivers/leds/leds-lt3593.c index c94995f0daa2..03ae33093ce6 100644 --- a/drivers/leds/leds-lt3593.c +++ b/drivers/leds/leds-lt3593.c @@ -103,10 +103,9 @@ static int lt3593_led_probe(struct platform_device *pdev) init_data.default_label = ":"; ret = devm_led_classdev_register_ext(dev, &led_data->cdev, &init_data); - if (ret < 0) { - fwnode_handle_put(child); + fwnode_handle_put(child); + if (ret < 0) return ret; - } led_data->cdev.dev->of_node = dev->of_node; platform_set_drvdata(pdev, led_data); |