Message ID | 20230322034128.1856117-1-windhl@126.com |
---|---|
State | New |
Headers | show |
Series | leds: mt6360: Add missing fwnode_handle_put() | expand |
Hi! > 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") > Signed-off-by: Liang He <windhl@126.com> I believe you got indentation wrong on }. With that fixed: Acked-by: Pavel Machek <pavel@ucw.cz> BR, Pavel > +++ b/drivers/leds/flash/leds-mt6360.c > @@ -637,14 +637,17 @@ static int mt6360_init_isnk_properties(struct mt6360_led *led, > > ret = fwnode_property_read_u32(child, "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; > } >
diff --git a/drivers/leds/flash/leds-mt6360.c b/drivers/leds/flash/leds-mt6360.c index e1066a52d2d2..bbb8e4284873 100644 --- a/drivers/leds/flash/leds-mt6360.c +++ b/drivers/leds/flash/leds-mt6360.c @@ -637,14 +637,17 @@ static int mt6360_init_isnk_properties(struct mt6360_led *led, ret = fwnode_property_read_u32(child, "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; }
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") Signed-off-by: Liang He <windhl@126.com> --- drivers/leds/flash/leds-mt6360.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)