public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH -next] greybus: arche-platform: Add missing of_node_put() in arche_platform_change_state()
@ 2016-10-17 16:37 Wei Yongjun
  2016-10-17 16:51 ` Johan Hovold
  0 siblings, 1 reply; 2+ messages in thread
From: Wei Yongjun @ 2016-10-17 16:37 UTC (permalink / raw)
  To: Vaibhav Hiremath, Johan Hovold, Alex Elder, Greg Kroah-Hartman
  Cc: Wei Yongjun, devel, linux-kernel

From: Wei Yongjun <weiyongjun1@huawei.com>

This node pointer is returned by of_find_compatible_node() with
refcount incremented in this function. of_node_put() on it before
exitting this function.

This is detected by Coccinelle semantic patch.

Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
---
 drivers/staging/greybus/arche-platform.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/staging/greybus/arche-platform.c b/drivers/staging/greybus/arche-platform.c
index a850f6b..389ed36 100644
--- a/drivers/staging/greybus/arche-platform.c
+++ b/drivers/staging/greybus/arche-platform.c
@@ -128,6 +128,7 @@ int arche_platform_change_state(enum arche_platform_state state,
 	pdev = of_find_device_by_node(np);
 	if (!pdev) {
 		pr_err("arche-platform device not found\n");
+		of_node_put(np);
 		return -ENODEV;
 	}
 

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

* Re: [PATCH -next] greybus: arche-platform: Add missing of_node_put() in arche_platform_change_state()
  2016-10-17 16:37 [PATCH -next] greybus: arche-platform: Add missing of_node_put() in arche_platform_change_state() Wei Yongjun
@ 2016-10-17 16:51 ` Johan Hovold
  0 siblings, 0 replies; 2+ messages in thread
From: Johan Hovold @ 2016-10-17 16:51 UTC (permalink / raw)
  To: Wei Yongjun
  Cc: Vaibhav Hiremath, Johan Hovold, Alex Elder, Greg Kroah-Hartman,
	Wei Yongjun, devel, linux-kernel

On Mon, Oct 17, 2016 at 04:37:20PM +0000, Wei Yongjun wrote:
> From: Wei Yongjun <weiyongjun1@huawei.com>
> 
> This node pointer is returned by of_find_compatible_node() with
> refcount incremented in this function. of_node_put() on it before
> exitting this function.
> 
> This is detected by Coccinelle semantic patch.
> 
> Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>

This code is going away eventually, but still.

Acked-by: Johan Hovold <johan@kernel.org>

Thanks,
Johan

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

end of thread, other threads:[~2016-10-17 16:51 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-10-17 16:37 [PATCH -next] greybus: arche-platform: Add missing of_node_put() in arche_platform_change_state() Wei Yongjun
2016-10-17 16:51 ` Johan Hovold

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox