linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] arch: x86: kernel: Add missing of_node_put() in x86_init.c
@ 2022-06-15 12:57 Liang He
  2022-10-17 13:56 ` Thomas Gleixner
  0 siblings, 1 reply; 2+ messages in thread
From: Liang He @ 2022-06-15 12:57 UTC (permalink / raw)
  To: tglx, mingo, bp, dave.hansen, x86, hpa
  Cc: jgg, kirill.shutemov, brijesh.singh, linux-kernel, windhl

In x86_wallclock_init(), we need to use of_node_put() for the
of_find_matching_node() which returns a node pointer with refcount
incremented.

Signed-off-by: Liang He <windhl@126.com>
---
 arch/x86/kernel/x86_init.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/x86/kernel/x86_init.c b/arch/x86/kernel/x86_init.c
index e84ee5cdbd8c..81c071080efe 100644
--- a/arch/x86/kernel/x86_init.c
+++ b/arch/x86/kernel/x86_init.c
@@ -50,6 +50,7 @@ static __init void x86_wallclock_init(void)
 	struct device_node *node = of_find_matching_node(NULL, of_cmos_match);
 
 	if (node && !of_device_is_available(node)) {
+		of_node_put(node);
 		x86_platform.get_wallclock = get_rtc_noop;
 		x86_platform.set_wallclock = set_rtc_noop;
 	}
-- 
2.25.1


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

* Re: [PATCH] arch: x86: kernel: Add missing of_node_put() in x86_init.c
  2022-06-15 12:57 [PATCH] arch: x86: kernel: Add missing of_node_put() in x86_init.c Liang He
@ 2022-10-17 13:56 ` Thomas Gleixner
  0 siblings, 0 replies; 2+ messages in thread
From: Thomas Gleixner @ 2022-10-17 13:56 UTC (permalink / raw)
  To: Liang He, mingo, bp, dave.hansen, x86, hpa
  Cc: jgg, kirill.shutemov, brijesh.singh, linux-kernel, windhl

Liang,

On Wed, Jun 15 2022 at 20:57, Liang He wrote:

please check https://www.kernel.org/doc/html/latest/process/maintainer-tip.html
for instructions vs. subject prefixes and changelogs.

> In x86_wallclock_init(), we need to use of_node_put() for the
> of_find_matching_node() which returns a node pointer with refcount
> incremented.
>
> Signed-off-by: Liang He <windhl@126.com>
> ---
>  arch/x86/kernel/x86_init.c | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/arch/x86/kernel/x86_init.c b/arch/x86/kernel/x86_init.c
> index e84ee5cdbd8c..81c071080efe 100644
> --- a/arch/x86/kernel/x86_init.c
> +++ b/arch/x86/kernel/x86_init.c
> @@ -50,6 +50,7 @@ static __init void x86_wallclock_init(void)
>  	struct device_node *node = of_find_matching_node(NULL, of_cmos_match);
>  
>  	if (node && !of_device_is_available(node)) {
> +		of_node_put(node);
>  		x86_platform.get_wallclock = get_rtc_noop;
>  		x86_platform.set_wallclock = set_rtc_noop;
>  	}

That still leaks the node in the case when the device is available, no?

Thanks,

        tglx

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

end of thread, other threads:[~2022-10-17 13:56 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-06-15 12:57 [PATCH] arch: x86: kernel: Add missing of_node_put() in x86_init.c Liang He
2022-10-17 13:56 ` Thomas Gleixner

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).