* [PATCH -next] MIPS: Loongson64: Add missing of_node_put() in ls2k_reset_init()
@ 2022-01-04 13:34 Yang Yingliang
2022-01-05 8:55 ` Thomas Bogendoerfer
0 siblings, 1 reply; 2+ messages in thread
From: Yang Yingliang @ 2022-01-04 13:34 UTC (permalink / raw)
To: linux-kernel, linux-mips; +Cc: tsbogend, zhangqing
This node pointer is returned by of_find_compatible_node() with
refcount incremented in ls2k_reset_init(). Calling of_node_put()
to aovid the refcount leak.
Fixes: 7eb7819a2e12 ("MIPS: Loongson64: Add Loongson-2K1000 reset platform driver")
Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
---
drivers/platform/mips/ls2k-reset.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/platform/mips/ls2k-reset.c b/drivers/platform/mips/ls2k-reset.c
index b70e7b8a092c..8f42d5d16480 100644
--- a/drivers/platform/mips/ls2k-reset.c
+++ b/drivers/platform/mips/ls2k-reset.c
@@ -38,6 +38,7 @@ static int ls2k_reset_init(void)
}
base = of_iomap(np, 0);
+ of_node_put(np);
if (!base) {
pr_info("Failed to map PM register base address\n");
return -ENOMEM;
@@ -46,7 +47,6 @@ static int ls2k_reset_init(void)
_machine_restart = ls2k_restart;
pm_power_off = ls2k_poweroff;
- of_node_put(np);
return 0;
}
--
2.25.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH -next] MIPS: Loongson64: Add missing of_node_put() in ls2k_reset_init()
2022-01-04 13:34 [PATCH -next] MIPS: Loongson64: Add missing of_node_put() in ls2k_reset_init() Yang Yingliang
@ 2022-01-05 8:55 ` Thomas Bogendoerfer
0 siblings, 0 replies; 2+ messages in thread
From: Thomas Bogendoerfer @ 2022-01-05 8:55 UTC (permalink / raw)
To: Yang Yingliang; +Cc: linux-kernel, linux-mips, zhangqing
On Tue, Jan 04, 2022 at 09:34:15PM +0800, Yang Yingliang wrote:
> This node pointer is returned by of_find_compatible_node() with
> refcount incremented in ls2k_reset_init(). Calling of_node_put()
> to aovid the refcount leak.
>
> Fixes: 7eb7819a2e12 ("MIPS: Loongson64: Add Loongson-2K1000 reset platform driver")
> Reported-by: Hulk Robot <hulkci@huawei.com>
> Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
> ---
> drivers/platform/mips/ls2k-reset.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/platform/mips/ls2k-reset.c b/drivers/platform/mips/ls2k-reset.c
> index b70e7b8a092c..8f42d5d16480 100644
> --- a/drivers/platform/mips/ls2k-reset.c
> +++ b/drivers/platform/mips/ls2k-reset.c
> @@ -38,6 +38,7 @@ static int ls2k_reset_init(void)
> }
>
> base = of_iomap(np, 0);
> + of_node_put(np);
> if (!base) {
> pr_info("Failed to map PM register base address\n");
> return -ENOMEM;
> @@ -46,7 +47,6 @@ static int ls2k_reset_init(void)
> _machine_restart = ls2k_restart;
> pm_power_off = ls2k_poweroff;
>
> - of_node_put(np);
> return 0;
> }
>
> --
> 2.25.1
applied to mips-next.
Thomas.
--
Crap can work. Given enough thrust pigs will fly, but it's not necessarily a
good idea. [ RFC1925, 2.3 ]
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-01-05 9:29 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-04 13:34 [PATCH -next] MIPS: Loongson64: Add missing of_node_put() in ls2k_reset_init() Yang Yingliang
2022-01-05 8:55 ` Thomas Bogendoerfer
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.