All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH -next] gpio: sim: add missing fwnode_handle_put() in gpio_sim_probe()
@ 2021-12-21 11:38 Yang Yingliang
  2021-12-21 15:22 ` Bartosz Golaszewski
  0 siblings, 1 reply; 2+ messages in thread
From: Yang Yingliang @ 2021-12-21 11:38 UTC (permalink / raw)
  To: linux-kernel, linux-gpio; +Cc: brgl, linus.walleij

Calling fwnode_handle_put() when break out of device_for_each_child_node(),
or the device node reference will be leakd.

Fixes: 83960fcf4818 ("gpio: sim: new testing module")
Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
---
 drivers/gpio/gpio-sim.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/gpio/gpio-sim.c b/drivers/gpio/gpio-sim.c
index ef6145f51c8a..520ee923b516 100644
--- a/drivers/gpio/gpio-sim.c
+++ b/drivers/gpio/gpio-sim.c
@@ -444,8 +444,10 @@ static int gpio_sim_probe(struct platform_device *pdev)
 
 	device_for_each_child_node(dev, swnode) {
 		ret = gpio_sim_add_bank(swnode, dev);
-		if (ret)
+		if (ret) {
+			fwnode_handle_put(swnode);
 			return ret;
+		}
 	}
 
 	return 0;
-- 
2.25.1


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

* Re: [PATCH -next] gpio: sim: add missing fwnode_handle_put() in gpio_sim_probe()
  2021-12-21 11:38 [PATCH -next] gpio: sim: add missing fwnode_handle_put() in gpio_sim_probe() Yang Yingliang
@ 2021-12-21 15:22 ` Bartosz Golaszewski
  0 siblings, 0 replies; 2+ messages in thread
From: Bartosz Golaszewski @ 2021-12-21 15:22 UTC (permalink / raw)
  To: Yang Yingliang
  Cc: Linux Kernel Mailing List, open list:GPIO SUBSYSTEM, Linus Walleij

On Tue, Dec 21, 2021 at 12:32 PM Yang Yingliang
<yangyingliang@huawei.com> wrote:
>
> Calling fwnode_handle_put() when break out of device_for_each_child_node(),
> or the device node reference will be leakd.
>
> Fixes: 83960fcf4818 ("gpio: sim: new testing module")
> Reported-by: Hulk Robot <hulkci@huawei.com>
> Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
> ---
>  drivers/gpio/gpio-sim.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpio/gpio-sim.c b/drivers/gpio/gpio-sim.c
> index ef6145f51c8a..520ee923b516 100644
> --- a/drivers/gpio/gpio-sim.c
> +++ b/drivers/gpio/gpio-sim.c
> @@ -444,8 +444,10 @@ static int gpio_sim_probe(struct platform_device *pdev)
>
>         device_for_each_child_node(dev, swnode) {
>                 ret = gpio_sim_add_bank(swnode, dev);
> -               if (ret)
> +               if (ret) {
> +                       fwnode_handle_put(swnode);
>                         return ret;
> +               }
>         }
>
>         return 0;
> --
> 2.25.1
>

Applied, thanks!

Bart

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

end of thread, other threads:[~2021-12-21 15:22 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-21 11:38 [PATCH -next] gpio: sim: add missing fwnode_handle_put() in gpio_sim_probe() Yang Yingliang
2021-12-21 15:22 ` Bartosz Golaszewski

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.