linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] fpga: stratix10-soc: fix wrong of_node_put() in init function
@ 2018-12-03 12:21 Nicolas Saenz Julienne
  2018-12-03 16:12 ` Alan Tull
  0 siblings, 1 reply; 4+ messages in thread
From: Nicolas Saenz Julienne @ 2018-12-03 12:21 UTC (permalink / raw)
  To: Alan Tull, Moritz Fischer
  Cc: Nicolas Saenz Julienne, linux-fpga, linux-kernel

After finding a "firmware" dt node stratix10 tries to match it's
compatible string with it. To do so it's calling of_find_matching_node()
which already takes care of decreasing the refcount on the "firmware"
node. We are then incorrectly decreasing the refcount on that node
again.

This patch removes the unwarranted call to of_node_put().

Fixes: e7eef1d7633a ("fpga: add intel stratix10 soc fpga manager driver")
Signed-off-by: Nicolas Saenz Julienne <nsaenzjulienne@suse.de>
---
 drivers/fpga/stratix10-soc.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/fpga/stratix10-soc.c b/drivers/fpga/stratix10-soc.c
index a1a09e04fab8..e75dbe583152 100644
--- a/drivers/fpga/stratix10-soc.c
+++ b/drivers/fpga/stratix10-soc.c
@@ -509,13 +509,11 @@ static int __init s10_init(void)
 
 	np = of_find_matching_node(fw_np, s10_of_match);
 	if (!np) {
-		of_node_put(fw_np);
 		return -ENODEV;
 	}
 
 	of_node_put(np);
 	ret = of_platform_populate(fw_np, s10_of_match, NULL, NULL);
-	of_node_put(fw_np);
 	if (ret)
 		return ret;
 
-- 
2.19.2


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

* Re: [PATCH] fpga: stratix10-soc: fix wrong of_node_put() in init function
  2018-12-03 12:21 [PATCH] fpga: stratix10-soc: fix wrong of_node_put() in init function Nicolas Saenz Julienne
@ 2018-12-03 16:12 ` Alan Tull
  2018-12-03 17:01   ` Moritz Fischer
  0 siblings, 1 reply; 4+ messages in thread
From: Alan Tull @ 2018-12-03 16:12 UTC (permalink / raw)
  To: nsaenzjulienne; +Cc: Moritz Fischer, linux-fpga, linux-kernel

On Mon, Dec 3, 2018 at 6:22 AM Nicolas Saenz Julienne
<nsaenzjulienne@suse.de> wrote:

Hi Nicolas,

Thanks for catching this!  I'll fix up one formatting thing (below).

>
> After finding a "firmware" dt node stratix10 tries to match it's
> compatible string with it. To do so it's calling of_find_matching_node()
> which already takes care of decreasing the refcount on the "firmware"
> node. We are then incorrectly decreasing the refcount on that node
> again.
>
> This patch removes the unwarranted call to of_node_put().
>
> Fixes: e7eef1d7633a ("fpga: add intel stratix10 soc fpga manager driver")
> Signed-off-by: Nicolas Saenz Julienne <nsaenzjulienne@suse.de>
Acked-by: Alan Tull <atull@kernel.org>

> ---
>  drivers/fpga/stratix10-soc.c | 2 --
>  1 file changed, 2 deletions(-)
>
> diff --git a/drivers/fpga/stratix10-soc.c b/drivers/fpga/stratix10-soc.c
> index a1a09e04fab8..e75dbe583152 100644
> --- a/drivers/fpga/stratix10-soc.c
> +++ b/drivers/fpga/stratix10-soc.c
> @@ -509,13 +509,11 @@ static int __init s10_init(void)
>
>         np = of_find_matching_node(fw_np, s10_of_match);
>         if (!np) {
> -               of_node_put(fw_np);
>                 return -ENODEV;
>         }

We don't need the brackets anymore around the return statement.  I'll fix it up.

Thanks,
Alan

>
>         of_node_put(np);
>         ret = of_platform_populate(fw_np, s10_of_match, NULL, NULL);
> -       of_node_put(fw_np);
>         if (ret)
>                 return ret;
>
> --
> 2.19.2
>

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

* Re: [PATCH] fpga: stratix10-soc: fix wrong of_node_put() in init function
  2018-12-03 16:12 ` Alan Tull
@ 2018-12-03 17:01   ` Moritz Fischer
  0 siblings, 0 replies; 4+ messages in thread
From: Moritz Fischer @ 2018-12-03 17:01 UTC (permalink / raw)
  To: Alan Tull; +Cc: nsaenzjulienne, linux-fpga, Linux Kernel Mailing List

Hi Nicolas,

good catch.

On Mon, Dec 3, 2018 at 8:13 AM Alan Tull <atull@kernel.org> wrote:
>
> On Mon, Dec 3, 2018 at 6:22 AM Nicolas Saenz Julienne
> <nsaenzjulienne@suse.de> wrote:
>
> Hi Nicolas,
>
> Thanks for catching this!  I'll fix up one formatting thing (below).
>
> >
> > After finding a "firmware" dt node stratix10 tries to match it's
> > compatible string with it. To do so it's calling of_find_matching_node()
> > which already takes care of decreasing the refcount on the "firmware"
> > node. We are then incorrectly decreasing the refcount on that node
> > again.
> >
> > This patch removes the unwarranted call to of_node_put().
> >
> > Fixes: e7eef1d7633a ("fpga: add intel stratix10 soc fpga manager driver")
> > Signed-off-by: Nicolas Saenz Julienne <nsaenzjulienne@suse.de>
> Acked-by: Alan Tull <atull@kernel.org>
Acked-by: Moritz Fischer <mdf@kernel.org>
>
> > ---
> >  drivers/fpga/stratix10-soc.c | 2 --
> >  1 file changed, 2 deletions(-)
> >
> > diff --git a/drivers/fpga/stratix10-soc.c b/drivers/fpga/stratix10-soc.c
> > index a1a09e04fab8..e75dbe583152 100644
> > --- a/drivers/fpga/stratix10-soc.c
> > +++ b/drivers/fpga/stratix10-soc.c
> > @@ -509,13 +509,11 @@ static int __init s10_init(void)
> >
> >         np = of_find_matching_node(fw_np, s10_of_match);
> >         if (!np) {
> > -               of_node_put(fw_np);
> >                 return -ENODEV;
> >         }
>
> We don't need the brackets anymore around the return statement.  I'll fix it up.
>
> Thanks,
> Alan
>
> >
> >         of_node_put(np);
> >         ret = of_platform_populate(fw_np, s10_of_match, NULL, NULL);
> > -       of_node_put(fw_np);
> >         if (ret)
> >                 return ret;
> >
> > --
> > 2.19.2
> >

Thanks,
Moritz

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

* [PATCH] fpga: stratix10-soc: fix wrong of_node_put() in init function
@ 2019-01-26 16:38 Alan Tull
  0 siblings, 0 replies; 4+ messages in thread
From: Alan Tull @ 2019-01-26 16:38 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Moritz Fischer, Dinh Nguyen, Alan Tull, linux-kernel, linux-fpga,
	Nicolas Saenz Julienne

From: Nicolas Saenz Julienne <nsaenzjulienne@suse.de>

After finding a "firmware" dt node stratix10 tries to match it's
compatible string with it. To do so it's calling of_find_matching_node()
which already takes care of decreasing the refcount on the "firmware"
node. We are then incorrectly decreasing the refcount on that node
again.

This patch removes the unwarranted call to of_node_put().

Fixes: e7eef1d7633a ("fpga: add intel stratix10 soc fpga manager driver")
Signed-off-by: Nicolas Saenz Julienne <nsaenzjulienne@suse.de>
Acked-by: Alan Tull <atull@kernel.org>
Acked-by: Moritz Fischer <mdf@kernel.org>
[atull: remove unnecessary braces]
---
 drivers/fpga/stratix10-soc.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/drivers/fpga/stratix10-soc.c b/drivers/fpga/stratix10-soc.c
index a1a09e04fab8..13851b3d1c56 100644
--- a/drivers/fpga/stratix10-soc.c
+++ b/drivers/fpga/stratix10-soc.c
@@ -508,14 +508,11 @@ static int __init s10_init(void)
 		return -ENODEV;
 
 	np = of_find_matching_node(fw_np, s10_of_match);
-	if (!np) {
-		of_node_put(fw_np);
+	if (!np)
 		return -ENODEV;
-	}
 
 	of_node_put(np);
 	ret = of_platform_populate(fw_np, s10_of_match, NULL, NULL);
-	of_node_put(fw_np);
 	if (ret)
 		return ret;
 
-- 
2.20.1


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

end of thread, other threads:[~2019-01-26 16:38 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-12-03 12:21 [PATCH] fpga: stratix10-soc: fix wrong of_node_put() in init function Nicolas Saenz Julienne
2018-12-03 16:12 ` Alan Tull
2018-12-03 17:01   ` Moritz Fischer
2019-01-26 16:38 Alan Tull

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