linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH V2] pinctrl: falcon: add missing put_device() call in pinctrl_falcon_probe()
       [not found] <e6241dd2-9ce8-9334-93f7-a4f84b20834e@web.de>
@ 2020-11-19  1:12 ` Yu Kuai
  2020-12-04  8:18   ` Linus Walleij
  0 siblings, 1 reply; 2+ messages in thread
From: Yu Kuai @ 2020-11-19  1:12 UTC (permalink / raw)
  To: linus.walleij, thomas.langer, blogic
  Cc: linux-gpio, linux-kernel, yukuai3, yi.zhang, zhangxiaoxu5

if of_find_device_by_node() succeed, pinctrl_falcon_probe() doesn't have
a corresponding put_device(). Thus add put_device() to fix the exception
handling for this function implementation.

Fixes: e316cb2b16bb ("OF: pinctrl: MIPS: lantiq: adds support for FALCON SoC")
Signed-off-by: Yu Kuai <yukuai3@huawei.com>
---
 drivers/pinctrl/pinctrl-falcon.c | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)

diff --git a/drivers/pinctrl/pinctrl-falcon.c b/drivers/pinctrl/pinctrl-falcon.c
index 62c02b969327..7521a924dffb 100644
--- a/drivers/pinctrl/pinctrl-falcon.c
+++ b/drivers/pinctrl/pinctrl-falcon.c
@@ -431,24 +431,28 @@ static int pinctrl_falcon_probe(struct platform_device *pdev)
 
 	/* load and remap the pad resources of the different banks */
 	for_each_compatible_node(np, NULL, "lantiq,pad-falcon") {
-		struct platform_device *ppdev = of_find_device_by_node(np);
 		const __be32 *bank = of_get_property(np, "lantiq,bank", NULL);
 		struct resource res;
+		struct platform_device *ppdev;
 		u32 avail;
 		int pins;
 
 		if (!of_device_is_available(np))
 			continue;
 
-		if (!ppdev) {
-			dev_err(&pdev->dev, "failed to find pad pdev\n");
-			continue;
-		}
 		if (!bank || *bank >= PORTS)
 			continue;
 		if (of_address_to_resource(np, 0, &res))
 			continue;
+
+		ppdev = of_find_device_by_node(np);
+		if (!ppdev) {
+			dev_err(&pdev->dev, "failed to find pad pdev\n");
+			continue;
+		}
+
 		falcon_info.clk[*bank] = clk_get(&ppdev->dev, NULL);
+		put_device(&ppdev->dev);
 		if (IS_ERR(falcon_info.clk[*bank])) {
 			dev_err(&ppdev->dev, "failed to get clock\n");
 			of_node_put(np);
-- 
2.25.4


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH V2] pinctrl: falcon: add missing put_device() call in pinctrl_falcon_probe()
  2020-11-19  1:12 ` [PATCH V2] pinctrl: falcon: add missing put_device() call in pinctrl_falcon_probe() Yu Kuai
@ 2020-12-04  8:18   ` Linus Walleij
  0 siblings, 0 replies; 2+ messages in thread
From: Linus Walleij @ 2020-12-04  8:18 UTC (permalink / raw)
  To: Yu Kuai
  Cc: Thomas Langer, John Crispin, open list:GPIO SUBSYSTEM,
	linux-kernel, yi.zhang, zhangxiaoxu5

On Thu, Nov 19, 2020 at 2:08 AM Yu Kuai <yukuai3@huawei.com> wrote:

> if of_find_device_by_node() succeed, pinctrl_falcon_probe() doesn't have
> a corresponding put_device(). Thus add put_device() to fix the exception
> handling for this function implementation.
>
> Fixes: e316cb2b16bb ("OF: pinctrl: MIPS: lantiq: adds support for FALCON SoC")
> Signed-off-by: Yu Kuai <yukuai3@huawei.com>

Patch applied!

Yours,
Linus Walleij

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-12-04  8:19 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <e6241dd2-9ce8-9334-93f7-a4f84b20834e@web.de>
2020-11-19  1:12 ` [PATCH V2] pinctrl: falcon: add missing put_device() call in pinctrl_falcon_probe() Yu Kuai
2020-12-04  8:18   ` Linus Walleij

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).