All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] power: reset: zx-reboot: put device node in zx_reboot_probe()
@ 2018-06-02 22:22 Alexey Khoroshilov
  2018-06-03  9:03 ` [SIL2review] " Nicholas Mc Guire
  2018-07-06 11:33 ` Sebastian Reichel
  0 siblings, 2 replies; 3+ messages in thread
From: Alexey Khoroshilov @ 2018-06-02 22:22 UTC (permalink / raw)
  To: Sebastian Reichel
  Cc: Alexey Khoroshilov, linux-pm, linux-kernel, ldv-project,
	Julia Lawall, sil2review

zx_reboot_probe() increments refcnt of zx296702-pcu device node by
of_find_compatible_node() and leaves it undecremented on both
successful and error paths.

Found by Linux Driver Verification project (linuxtesting.org).

Signed-off-by: Alexey Khoroshilov <khoroshilov@ispras.ru>
---
 drivers/power/reset/zx-reboot.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/power/reset/zx-reboot.c b/drivers/power/reset/zx-reboot.c
index c03e96e6a041..186901c96c01 100644
--- a/drivers/power/reset/zx-reboot.c
+++ b/drivers/power/reset/zx-reboot.c
@@ -51,6 +51,7 @@ static int zx_reboot_probe(struct platform_device *pdev)
 
 	np = of_find_compatible_node(NULL, NULL, "zte,zx296702-pcu");
 	pcu_base = of_iomap(np, 0);
+	of_node_put(np);
 	if (!pcu_base) {
 		iounmap(base);
 		WARN(1, "failed to map pcu_base address");
-- 
2.7.4

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

* Re: [SIL2review] [PATCH] power: reset: zx-reboot: put device node in zx_reboot_probe()
  2018-06-02 22:22 [PATCH] power: reset: zx-reboot: put device node in zx_reboot_probe() Alexey Khoroshilov
@ 2018-06-03  9:03 ` Nicholas Mc Guire
  2018-07-06 11:33 ` Sebastian Reichel
  1 sibling, 0 replies; 3+ messages in thread
From: Nicholas Mc Guire @ 2018-06-03  9:03 UTC (permalink / raw)
  To: Alexey Khoroshilov
  Cc: Sebastian Reichel, ldv-project, sil2review, linux-pm,
	linux-kernel, Julia Lawall

On Sun, Jun 03, 2018 at 01:22:05AM +0300, Alexey Khoroshilov wrote:
> zx_reboot_probe() increments refcnt of zx296702-pcu device node by
> of_find_compatible_node() and leaves it undecremented on both
> successful and error paths.
>

Just wonder - if it warns on the failed case it probably should also
note if it failed in of_find_compatible_node() or not to allow
diagnosing the problem (the compatible_node score was 0) ? 

> Found by Linux Driver Verification project (linuxtesting.org).
> 
> Signed-off-by: Alexey Khoroshilov <khoroshilov@ispras.ru>
Reviewed-by: Nicholas Mc Guire <der.herr@hofr.at>

> ---
>  drivers/power/reset/zx-reboot.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/power/reset/zx-reboot.c b/drivers/power/reset/zx-reboot.c
> index c03e96e6a041..186901c96c01 100644
> --- a/drivers/power/reset/zx-reboot.c
> +++ b/drivers/power/reset/zx-reboot.c
> @@ -51,6 +51,7 @@ static int zx_reboot_probe(struct platform_device *pdev)
>  
>  	np = of_find_compatible_node(NULL, NULL, "zte,zx296702-pcu");
>  	pcu_base = of_iomap(np, 0);
> +	of_node_put(np);
>  	if (!pcu_base) {
>  		iounmap(base);
>  		WARN(1, "failed to map pcu_base address");
> -- 
> 2.7.4
> 
> _______________________________________________
> SIL2review mailing list
> SIL2review@lists.osadl.org
> https://lists.osadl.org/mailman/listinfo/sil2review

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

* Re: [PATCH] power: reset: zx-reboot: put device node in zx_reboot_probe()
  2018-06-02 22:22 [PATCH] power: reset: zx-reboot: put device node in zx_reboot_probe() Alexey Khoroshilov
  2018-06-03  9:03 ` [SIL2review] " Nicholas Mc Guire
@ 2018-07-06 11:33 ` Sebastian Reichel
  1 sibling, 0 replies; 3+ messages in thread
From: Sebastian Reichel @ 2018-07-06 11:33 UTC (permalink / raw)
  To: Alexey Khoroshilov
  Cc: linux-pm, linux-kernel, ldv-project, Julia Lawall, sil2review

[-- Attachment #1: Type: text/plain, Size: 440 bytes --]

Hi,

On Sun, Jun 03, 2018 at 01:22:05AM +0300, Alexey Khoroshilov wrote:
> zx_reboot_probe() increments refcnt of zx296702-pcu device node by
> of_find_compatible_node() and leaves it undecremented on both
> successful and error paths.
> 
> Found by Linux Driver Verification project (linuxtesting.org).
> 
> Signed-off-by: Alexey Khoroshilov <khoroshilov@ispras.ru>
> ---

Thanks, queued to power-supply-next.

-- Sebastian

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

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

end of thread, other threads:[~2018-07-06 11:33 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-06-02 22:22 [PATCH] power: reset: zx-reboot: put device node in zx_reboot_probe() Alexey Khoroshilov
2018-06-03  9:03 ` [SIL2review] " Nicholas Mc Guire
2018-07-06 11:33 ` Sebastian Reichel

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.