linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] arch: arm: mach-versatile: Add missing of_node_put in integrator.c
@ 2022-06-15  9:05 heliang
  2023-09-13 12:10 ` Linus Walleij
  2023-09-13 13:01 ` Rob Herring
  0 siblings, 2 replies; 4+ messages in thread
From: heliang @ 2022-06-15  9:05 UTC (permalink / raw)
  To: linus.walleij, linux; +Cc: linux-arm-kernel, linux-kernel, windhl

In cm_init(), of_find_matching_node() will return a node pointer with
refcount incremented. We should use of_node_put() when the pointer is
not used anymore.

Signed-off-by: heliang <windhl@126.com>
---
 arch/arm/mach-versatile/integrator.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/arm/mach-versatile/integrator.c b/arch/arm/mach-versatile/integrator.c
index fdf9c4db08a7..fba19357171a 100644
--- a/arch/arm/mach-versatile/integrator.c
+++ b/arch/arm/mach-versatile/integrator.c
@@ -76,6 +76,7 @@ void cm_init(void)
 		return;
 	}
 	cm_base = of_iomap(cm, 0);
+	of_node_put(cm);
 	if (!cm_base) {
 		pr_crit("could not remap core module\n");
 		return;
-- 
2.25.1


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

* Re: [PATCH] arch: arm: mach-versatile: Add missing of_node_put in integrator.c
  2022-06-15  9:05 [PATCH] arch: arm: mach-versatile: Add missing of_node_put in integrator.c heliang
@ 2023-09-13 12:10 ` Linus Walleij
  2023-09-13 13:01 ` Rob Herring
  1 sibling, 0 replies; 4+ messages in thread
From: Linus Walleij @ 2023-09-13 12:10 UTC (permalink / raw)
  To: heliang; +Cc: linux, linux-arm-kernel, linux-kernel

On Wed, Jun 15, 2022 at 11:05 AM heliang <windhl@126.com> wrote:

> In cm_init(), of_find_matching_node() will return a node pointer with
> refcount incremented. We should use of_node_put() when the pointer is
> not used anymore.
>
> Signed-off-by: heliang <windhl@126.com>

Patch applied.

Yours,
Linus Walleij

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

* Re: [PATCH] arch: arm: mach-versatile: Add missing of_node_put in integrator.c
  2022-06-15  9:05 [PATCH] arch: arm: mach-versatile: Add missing of_node_put in integrator.c heliang
  2023-09-13 12:10 ` Linus Walleij
@ 2023-09-13 13:01 ` Rob Herring
  2023-09-14 13:57   ` Linus Walleij
  1 sibling, 1 reply; 4+ messages in thread
From: Rob Herring @ 2023-09-13 13:01 UTC (permalink / raw)
  To: heliang; +Cc: linus.walleij, linux, linux-arm-kernel, linux-kernel

On Wed, Jun 15, 2022 at 4:06 AM heliang <windhl@126.com> wrote:
>
> In cm_init(), of_find_matching_node() will return a node pointer with
> refcount incremented. We should use of_node_put() when the pointer is
> not used anymore.
>
> Signed-off-by: heliang <windhl@126.com>
> ---
>  arch/arm/mach-versatile/integrator.c | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/arch/arm/mach-versatile/integrator.c b/arch/arm/mach-versatile/integrator.c
> index fdf9c4db08a7..fba19357171a 100644
> --- a/arch/arm/mach-versatile/integrator.c
> +++ b/arch/arm/mach-versatile/integrator.c
> @@ -76,6 +76,7 @@ void cm_init(void)
>                 return;
>         }
>         cm_base = of_iomap(cm, 0);
> +       of_node_put(cm);

Not really sure this is right. It is in the sense that the DT node is
never accessed again. However, the device itself is still accessed and
I tend to think a ref to the DT node should be held for that lifetime
which in this case is forever. Really, none of this matters because
nodes are never removed and these fixes are kind of pointless.

Note that cm_get() and cm_control() are never used and can be removed.
That would be the more useful clean-up.

Rob

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

* Re: [PATCH] arch: arm: mach-versatile: Add missing of_node_put in integrator.c
  2023-09-13 13:01 ` Rob Herring
@ 2023-09-14 13:57   ` Linus Walleij
  0 siblings, 0 replies; 4+ messages in thread
From: Linus Walleij @ 2023-09-14 13:57 UTC (permalink / raw)
  To: Rob Herring; +Cc: heliang, linux, linux-arm-kernel, linux-kernel

On Wed, Sep 13, 2023 at 3:01 PM Rob Herring <robh@kernel.org> wrote:
> On Wed, Jun 15, 2022 at 4:06 AM heliang <windhl@126.com> wrote:
> >
> > In cm_init(), of_find_matching_node() will return a node pointer with
> > refcount incremented. We should use of_node_put() when the pointer is
> > not used anymore.
> >
> > Signed-off-by: heliang <windhl@126.com>
> > ---
> >  arch/arm/mach-versatile/integrator.c | 1 +
> >  1 file changed, 1 insertion(+)
> >
> > diff --git a/arch/arm/mach-versatile/integrator.c b/arch/arm/mach-versatile/integrator.c
> > index fdf9c4db08a7..fba19357171a 100644
> > --- a/arch/arm/mach-versatile/integrator.c
> > +++ b/arch/arm/mach-versatile/integrator.c
> > @@ -76,6 +76,7 @@ void cm_init(void)
> >                 return;
> >         }
> >         cm_base = of_iomap(cm, 0);
> > +       of_node_put(cm);
>
> Not really sure this is right. It is in the sense that the DT node is
> never accessed again. However, the device itself is still accessed and
> I tend to think a ref to the DT node should be held for that lifetime
> which in this case is forever. Really, none of this matters because
> nodes are never removed and these fixes are kind of pointless.

I'm just gonna scrap all these of_node_put() patches these automated
static analyzers have sent to the Versatile board and SoC code, it's
too dangerous.

> Note that cm_get() and cm_control() are never used and can be removed.
> That would be the more useful clean-up.

Yeah :/

Yours,
Linus Walleij

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

end of thread, other threads:[~2023-09-14 13:58 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-15  9:05 [PATCH] arch: arm: mach-versatile: Add missing of_node_put in integrator.c heliang
2023-09-13 12:10 ` Linus Walleij
2023-09-13 13:01 ` Rob Herring
2023-09-14 13:57   ` Linus Walleij

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