Skip to content

Commit

Permalink
leds: lm36274: Put fwnode in error case during ->probe()
Browse files Browse the repository at this point in the history
[ Upstream commit 3c5f655 ]

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

In the older code the same is implied with device_for_each_child_node().

Fixes: 11e1bbc ("leds: lm36274: Introduce the TI LM36274 LED driver")
Fixes: a448fcf ("leds: lm36274: don't iterate through children since there is only one")
Cc: Dan Murphy <dmurphy@ti.com>
Cc: Marek Behún <marek.behun@nic.cz>
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 Jul 14, 2021
1 parent 1ed9133 commit c54ad49
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions drivers/leds/leds-lm36274.c
Expand Up @@ -127,6 +127,7 @@ static int lm36274_probe(struct platform_device *pdev)

ret = lm36274_init(chip);
if (ret) {
fwnode_handle_put(init_data.fwnode);
dev_err(chip->dev, "Failed to init the device\n");
return ret;
}
Expand Down

0 comments on commit c54ad49

Please sign in to comment.