leds: lm36274: Put fwnode in error case during ->probe()
authorAndy Shevchenko <andy.shevchenko@gmail.com>
Mon, 10 May 2021 09:50:33 +0000 (12:50 +0300)
committerPavel Machek <pavel@ucw.cz>
Fri, 28 May 2021 10:00:14 +0000 (12:00 +0200)
device_get_next_child_node() bumps a reference counting of a returned variable.
We have to balance it whenever we return to the caller.

In the older code the same is implied with device_for_each_child_node().

Fixes: 11e1bbc116a7 ("leds: lm36274: Introduce the TI LM36274 LED driver")
Fixes: a448fcf19c9c ("leds: lm36274: don't iterate through children since there is only one")
Cc: Dan Murphy <dmurphy@ti.com>
Cc: Marek BehĂșn <marek.behun@nic.cz>
Signed-off-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Signed-off-by: Pavel Machek <pavel@ucw.cz>
drivers/leds/leds-lm36274.c

index aadb034..a23a942 100644 (file)
@@ -127,6 +127,7 @@ static int lm36274_probe(struct platform_device *pdev)
 
        ret = lm36274_init(chip);
        if (ret) {
+               fwnode_handle_put(init_data.fwnode);
                dev_err(chip->dev, "Failed to init the device\n");
                return ret;
        }