Skip to content

Commit

Permalink
leds: lt3593: Put fwnode in any case during ->probe()
Browse files Browse the repository at this point in the history
[ Upstream commit 7e1baaa ]

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: 8cd7d6d ("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>
  • Loading branch information
andy-shev authored and gregkh committed Sep 15, 2021
1 parent eef8496 commit 917191d
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions drivers/leds/leds-lt3593.c
Expand Up @@ -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);

Expand Down

0 comments on commit 917191d

Please sign in to comment.