Skip to contentSkip to conversation

leds: tlc591xx: fix leak of device node iterator

PATCH Applied Tobias Jordan 3 participants 3 messages Sep 26, 2020 – Sep 30, 2020 LED

v2 of 3 Applied Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 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")

---
v2: rebased to Pavel's for-next branch

 drivers/leds/leds-tlc591xx.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/leds/leds-tlc591xx.c +3 -1
index f24271337bd8..5b9dfdf743ec 100644
@@ -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;
 }
Signature · 1 line
2.20.1
Reviewed-by on v2 1/1
#1 lore raw
Quoted 21 lines · On Sat, 26 Sep 2020 02:51:17 +0200 Tobias Jordan <[email protected]> wrote:

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")

---
v2: rebased to Pavel's for-next branch

 drivers/leds/leds-tlc591xx.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/leds/leds-tlc591xx.c +0 -0
index f24271337bd8..5b9dfdf743ec 100644
@@ -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);

drivers/leds/leds-tlc591xx.c tlc591xx_probe(struct i2c_client *client, · line 216

Quoted 10 lines
drivers/leds/leds-tlc591xx.c +3 -1
-		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;
 }
Applied
#2 lore raw

Hi!

Quoted 9 lines
Quoted 7 lines

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")

Thanks, applied.

Marek: Thanks for review. If I can get you to trim parts not interesting for the email, I'll be even happier.

:-).

Best regards,

Pavel

Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html