Skip to contentSkip to conversation

leds: tlc591xx: fix leak of device node iterator

PATCH In review Tobias Jordan 2 participants 2 messages Sep 26, 2020 – Sep 29, 2020 LED

lore
Share & tools
lore
#0 lore raw

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

---
v3: removed linebreak from Fixes: tag in commit message
v2: rebased to Pavel's for-next branch

 drivers/leds/leds-tlc591xx.c | 1 +
 1 file changed, 1 insertion(+)
drivers/leds/leds-tlc591xx.c +1 -0
index 0929f1275814..a8cc49752cd5 100644
@@ -214,6 +214,7 @@ tlc591xx_probe(struct i2c_client *client,
 		err = devm_led_classdev_register_ext(dev, &led->ldev,
 						     &init_data);
 		if (err < 0) {
+			of_node_put(child);
 			if (err != -EPROBE_DEFER)
 				dev_err(dev, "couldn't register LED %s\n",
 					led->ldev.name);
Signature · 1 line
2.20.1
Reviewed-by on v3 1/1
#1 lore raw
Quoted 20 lines · Tobias Jordan

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

---
v3: removed linebreak from Fixes: tag in commit message
v2: rebased to Pavel's for-next branch

 drivers/leds/leds-tlc591xx.c | 1 +
 1 file changed, 1 insertion(+)
drivers/leds/leds-tlc591xx.c +0 -0
index 0929f1275814..a8cc49752cd5 100644

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

Quoted 7 lines
drivers/leds/leds-tlc591xx.c +1 -0
@@ -214,6 +214,7 @@ tlc591xx_probe(struct i2c_client *client,
 		err = devm_led_classdev_register_ext(dev, &led->ldev,
 						     &init_data);
 		if (err < 0) {
+			of_node_put(child);
 			if (err != -EPROBE_DEFER)
 				dev_err(dev, "couldn't register LED %s\n",
 					led->ldev.name);

Tomi

Signature · 2 lines
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki