Skip to content

Commit

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

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: 9a5c1c6 ("leds: lm3692x: Change DT calls to fwnode calls")
Cc: Dan Murphy <dmurphy@ti.com>
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 9578f87 commit a6caae8
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions drivers/leds/leds-lm3692x.c
Original file line number Diff line number Diff line change
Expand Up @@ -435,6 +435,7 @@ static int lm3692x_probe_dt(struct lm3692x_led *led)

ret = fwnode_property_read_u32(child, "reg", &led->led_enable);
if (ret) {
fwnode_handle_put(child);
dev_err(&led->client->dev, "reg DT property missing\n");
return ret;
}
Expand All @@ -449,12 +450,11 @@ static int lm3692x_probe_dt(struct lm3692x_led *led)

ret = devm_led_classdev_register_ext(&led->client->dev, &led->led_dev,
&init_data);
if (ret) {
if (ret)
dev_err(&led->client->dev, "led register err: %d\n", ret);
return ret;
}

return 0;
fwnode_handle_put(init_data.fwnode);
return ret;
}

static int lm3692x_probe(struct i2c_client *client,
Expand Down

0 comments on commit a6caae8

Please sign in to comment.