Skip to content

Commit

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

fwnode_get_next_available_child_node() bumps a reference counting of
a returned variable. We have to balance it whenever we return to
the caller.

Fixes: e1c6edc ("leds: rt8515: Add Richtek RT8515 LED driver")
Signed-off-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Signed-off-by: Pavel Machek <pavel@ucw.cz>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
  • Loading branch information
andy-shev authored and gregkh committed Sep 15, 2021
1 parent 2d59a91 commit e7e692b
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion drivers/leds/flash/leds-rt8515.c
Expand Up @@ -343,8 +343,9 @@ static int rt8515_probe(struct platform_device *pdev)

ret = devm_led_classdev_flash_register_ext(dev, fled, &init_data);
if (ret) {
dev_err(dev, "can't register LED %s\n", led->name);
fwnode_handle_put(child);
mutex_destroy(&rt->lock);
dev_err(dev, "can't register LED %s\n", led->name);
return ret;
}

Expand All @@ -362,6 +363,7 @@ static int rt8515_probe(struct platform_device *pdev)
*/
}

fwnode_handle_put(child);
return 0;
}

Expand Down

0 comments on commit e7e692b

Please sign in to comment.