[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20210510095045.3299382-24-andy.shevchenko@gmail.com>
Date: Mon, 10 May 2021 12:50:40 +0300
From: Andy Shevchenko <andy.shevchenko@...il.com>
To: Pavel Machek <pavel@....cz>,
Andy Shevchenko <andriy.shevchenko@...ux.intel.com>,
Amireddy Mallikarjuna reddy
<mallikarjunax.reddy@...ux.intel.com>,
Linus Walleij <linus.walleij@...aro.org>,
Marek BehĂșn <marek.behun@....cz>,
Abanoub Sameh <abanoubsameh8@...il.com>,
Dan Murphy <dmurphy@...com>,
Krzysztof Kozlowski <krzk@...nel.org>,
linux-leds@...r.kernel.org, linux-kernel@...r.kernel.org
Cc: Andy Shevchenko <andy.shevchenko@...il.com>
Subject: [PATCH v1 23/28] leds: lp50xx: Put fwnode in error case during ->probe()
fwnode_for_each_child_node() bumps a reference counting of a returned variable.
We have to balance it whenever we return to the caller.
OTOH, the successful iteration will drop reference count under the hood, no need
to do it twice.
Fixes: 242b81170fb8 ("leds: lp50xx: Add the LP50XX family of the RGB LED driver")
Cc: Dan Murphy <dmurphy@...com>
Signed-off-by: Andy Shevchenko <andy.shevchenko@...il.com>
---
drivers/leds/leds-lp50xx.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/leds/leds-lp50xx.c b/drivers/leds/leds-lp50xx.c
index 06230614fdc5..401df1e2e05d 100644
--- a/drivers/leds/leds-lp50xx.c
+++ b/drivers/leds/leds-lp50xx.c
@@ -490,6 +490,7 @@ static int lp50xx_probe_dt(struct lp50xx *priv)
ret = fwnode_property_read_u32(led_node, "color",
&color_id);
if (ret) {
+ fwnode_handle_put(led_node);
dev_err(priv->dev, "Cannot read color\n");
goto child_out;
}
@@ -512,7 +513,6 @@ static int lp50xx_probe_dt(struct lp50xx *priv)
goto child_out;
}
i++;
- fwnode_handle_put(child);
}
return 0;
--
2.31.1
Powered by blists - more mailing lists