Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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: 1ab4531ad132 ("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>

authored by

Tobias Jordan and committed by
Pavel Machek
108f4664 564ead12

+3 -1
+3 -1
drivers/leds/leds-tlc591xx.c
··· 205 205 led->ldev.max_brightness = TLC591XX_MAX_BRIGHTNESS; 206 206 err = devm_led_classdev_register_ext(dev, &led->ldev, 207 207 &init_data); 208 - if (err < 0) 208 + if (err < 0) { 209 + of_node_put(child); 209 210 return dev_err_probe(dev, err, 210 211 "couldn't register LED %s\n", 211 212 led->ldev.name); 213 + } 212 214 } 213 215 return 0; 214 216 }