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: 1ab4531ad1 ("leds: tlc591xx: simplify driver by using the managed led API")

Signed-off-by: Tobias Jordan <kernel@cdqe.de>
Reviewed-by: Marek Behún <kabel@kernel.org>
Reviewed-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
Signed-off-by: Pavel Machek <pavel@ucw.cz>
This commit is contained in:
Tobias Jordan 2020-09-26 02:51:17 +02:00 committed by Pavel Machek
parent 564ead1280
commit 108f4664e3

View File

@ -205,11 +205,13 @@ 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;
}