Commit 108f4664 authored by Tobias Jordan's avatar Tobias Jordan Committed by Pavel Machek

leds: tlc591xx: fix leak of device node iterator

In one of the error paths of the for_each_child_of_node loop in
tlc591xx_probe, add missing call to of_node_put.

Fixes: 1ab4531a ("leds: tlc591xx: simplify driver by using the managed led API")
Signed-off-by: default avatarTobias Jordan <kernel@cdqe.de>
Reviewed-by: default avatarMarek Behún <kabel@kernel.org>
Reviewed-by: default avatarTomi Valkeinen <tomi.valkeinen@ti.com>
Signed-off-by: default avatarPavel Machek <pavel@ucw.cz>
parent 564ead12
......@@ -205,10 +205,12 @@ tlc591xx_probe(struct i2c_client *client,
led->ldev.max_brightness = TLC591XX_MAX_BRIGHTNESS;
err = devm_led_classdev_register_ext(dev, &led->ldev,
&init_data);
if (err < 0)
if (err < 0) {
of_node_put(child);
return dev_err_probe(dev, err,
"couldn't register LED %s\n",
led->ldev.name);
}
}
return 0;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment