Skip to contentSkip to conversation

leds: mt6360: Add missing fwnode_handle_put()

PATCH In review Liang He 2 participants 2 messages Mar 22, 2023 – Mar 23, 2023

Subsystems (2)
lore
Share & tools
lore

Liang He

author
#0 lore raw

PATCH 1/1 leds: mt6360: Add missing fwnode_handle_put()

In mt6360_init_isnk_properties(), we should add fwnode_handle_put() when break out of the iteration fwnode_for_each_child_node() as it will automatically increase and decrease the refcounter.

Fixes 679f8652064b ("leds: Add mt6360 driver")
---
 drivers/leds/flash/leds-mt6360.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/leds/flash/leds-mt6360.c +4 -1
index e1066a52d2d2..bbb8e4284873 100644
@@ -637,14 +637,17 @@ static int mt6360_init_isnk_properties(struct mt6360_led *led,
 
 			ret = fwnode_property_read_u32(child, "reg", &reg);
 			if (ret || reg > MT6360_LED_ISNK3 ||
-			    priv->leds_active & BIT(reg))
+			    priv->leds_active & BIT(reg)) {
+				fwnode_handle_put(child);
 				return -EINVAL;
+				}
 
 			ret = fwnode_property_read_u32(child, "color", &color);
 			if (ret) {
 				dev_err(priv->dev,
 					"led %d, no color specified\n",
 					led->led_no);
+				fwnode_handle_put(child);
 				return ret;
 			}
 
Signature · 1 line
2.25.1
Acked-by on v1 1/1
#1 lore raw

Hi!

Quoted 7 lines

In mt6360_init_isnk_properties(), we should add fwnode_handle_put() when break out of the iteration fwnode_for_each_child_node() as it will automatically increase and decrease the refcounter.

Fixes 679f8652064b ("leds: Add mt6360 driver")

I believe you got indentation wrong on }.

With that fixed:

BR,
Pavel

Quoted 20 lines

+++ b/drivers/leds/flash/leds-mt6360.c

drivers/leds/flash/leds-mt6360.c +4 -1
@@ -637,14 +637,17 @@ static int mt6360_init_isnk_properties(struct mt6360_led *led,
 
 			ret = fwnode_property_read_u32(child, "reg", &reg);
 			if (ret || reg > MT6360_LED_ISNK3 ||
-			    priv->leds_active & BIT(reg))
+			    priv->leds_active & BIT(reg)) {
+				fwnode_handle_put(child);
 				return -EINVAL;
+				}
 
 			ret = fwnode_property_read_u32(child, "color", &color);
 			if (ret) {
 				dev_err(priv->dev,
 					"led %d, no color specified\n",
 					led->led_no);
+				fwnode_handle_put(child);
 				return ret;
 			}
 
Signature · 1 line
People of Russia, stop Putin before his war on Ukraine escalates.