]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
leds: lt3593: Put fwnode in any case during ->probe()
authorAndy Shevchenko <andy.shevchenko@gmail.com>
Sat, 29 May 2021 11:19:33 +0000 (14:19 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 15 Sep 2021 07:50:36 +0000 (09:50 +0200)
[ 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>
drivers/leds/leds-lt3593.c

index 68e06434ac087a585ce2b9e2f9ecc6059b308bb8..7dab08773a347fef4b2d3f7fc49ac99e48af604a 100644 (file)
@@ -99,10 +99,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;
-       }
 
        platform_set_drvdata(pdev, led_data);