backlight: lm3630a_bl: Put fwnode in error case during ->probe()
authorAndy Shevchenko <andy.shevchenko@gmail.com>
Mon, 10 May 2021 09:57:16 +0000 (12:57 +0300)
committerLee Jones <lee.jones@linaro.org>
Wed, 19 May 2021 14:31:03 +0000 (15:31 +0100)
device_for_each_child_node() bumps a reference counting of a returned variable.
We have to balance it whenever we return to the caller.

Cc: Brian Masney <masneyb@onstation.org>
Cc: Dan Murphy <dmurphy@ti.com>
Fixes: 8fbce8efe15cd ("backlight: lm3630a: Add firmware node support")
Signed-off-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Reviewed-by: Brian Masney <masneyb@onstation.org>
Reviewed-by: Daniel Thompson <daniel.thompson@linaro.org>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
drivers/video/backlight/lm3630a_bl.c

index e88a2b0e59046a27cf3610bfbf43a12cbffe4dee..662029d6a3dc9705d073ddfaf75557bb608dccd8 100644 (file)
@@ -482,8 +482,10 @@ static int lm3630a_parse_node(struct lm3630a_chip *pchip,
 
        device_for_each_child_node(pchip->dev, node) {
                ret = lm3630a_parse_bank(pdata, node, &seen_led_sources);
-               if (ret)
+               if (ret) {
+                       fwnode_handle_put(node);
                        return ret;
+               }
        }
 
        return ret;