Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

leds: lt3593: Put fwnode in any case during ->probe()

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>

authored by

Andy Shevchenko and committed by
Pavel Machek
7e1baaaa d299ae94

+2 -3
+2 -3
drivers/leds/leds-lt3593.c
··· 97 97 init_data.default_label = ":"; 98 98 99 99 ret = devm_led_classdev_register_ext(dev, &led_data->cdev, &init_data); 100 - if (ret < 0) { 101 - fwnode_handle_put(child); 100 + fwnode_handle_put(child); 101 + if (ret < 0) 102 102 return ret; 103 - } 104 103 105 104 platform_set_drvdata(pdev, led_data); 106 105