All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] memory: atmel-ebi: Fix missing of_node_put in atmel_ebi_probe
@ 2022-03-09 11:01 ` Miaoqian Lin
  0 siblings, 0 replies; 8+ messages in thread
From: Miaoqian Lin @ 2022-03-09 11:01 UTC (permalink / raw)
  To: Krzysztof Kozlowski, Nicolas Ferre, Alexandre Belloni,
	Claudiu Beznea, Boris Brezillon, linux-kernel, linux-arm-kernel
  Cc: linmq006

The device_node pointer is returned by of_parse_phandle() with refcount
incremented. We should use of_node_put() on it when done.

Fixes: 87108dc78eb8 ("memory: atmel-ebi: Enable the SMC clock if specified")
Signed-off-by: Miaoqian Lin <linmq006@gmail.com>
---
 drivers/memory/atmel-ebi.c | 23 +++++++++++++++++------
 1 file changed, 17 insertions(+), 6 deletions(-)

diff --git a/drivers/memory/atmel-ebi.c b/drivers/memory/atmel-ebi.c
index c267283b01fd..e749dcb3ddea 100644
--- a/drivers/memory/atmel-ebi.c
+++ b/drivers/memory/atmel-ebi.c
@@ -544,20 +544,27 @@ static int atmel_ebi_probe(struct platform_device *pdev)
 	smc_np = of_parse_phandle(dev->of_node, "atmel,smc", 0);
 
 	ebi->smc.regmap = syscon_node_to_regmap(smc_np);
-	if (IS_ERR(ebi->smc.regmap))
-		return PTR_ERR(ebi->smc.regmap);
+	if (IS_ERR(ebi->smc.regmap)) {
+		ret = PTR_ERR(ebi->smc.regmap);
+		goto put_node;
+	}
 
 	ebi->smc.layout = atmel_hsmc_get_reg_layout(smc_np);
-	if (IS_ERR(ebi->smc.layout))
-		return PTR_ERR(ebi->smc.layout);
+	if (IS_ERR(ebi->smc.layout)) {
+		ret = PTR_ERR(ebi->smc.layout);
+		goto put_node;
+	}
 
 	ebi->smc.clk = of_clk_get(smc_np, 0);
 	if (IS_ERR(ebi->smc.clk)) {
-		if (PTR_ERR(ebi->smc.clk) != -ENOENT)
-			return PTR_ERR(ebi->smc.clk);
+		if (PTR_ERR(ebi->smc.clk) != -ENOENT) {
+			ret = PTR_ERR(ebi->smc.clk);
+			goto put_node;
+		}
 
 		ebi->smc.clk = NULL;
 	}
+	of_node_put(smc_np);
 	ret = clk_prepare_enable(ebi->smc.clk);
 	if (ret)
 		return ret;
@@ -608,6 +615,10 @@ static int atmel_ebi_probe(struct platform_device *pdev)
 	}
 
 	return of_platform_populate(np, NULL, NULL, dev);
+
+put_node:
+	of_node_put(smc_np);
+	return ret;
 }
 
 static __maybe_unused int atmel_ebi_resume(struct device *dev)
-- 
2.17.1


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

* [PATCH] memory: atmel-ebi: Fix missing of_node_put in atmel_ebi_probe
@ 2022-03-09 11:01 ` Miaoqian Lin
  0 siblings, 0 replies; 8+ messages in thread
From: Miaoqian Lin @ 2022-03-09 11:01 UTC (permalink / raw)
  To: Krzysztof Kozlowski, Nicolas Ferre, Alexandre Belloni,
	Claudiu Beznea, Boris Brezillon, linux-kernel, linux-arm-kernel
  Cc: linmq006

The device_node pointer is returned by of_parse_phandle() with refcount
incremented. We should use of_node_put() on it when done.

Fixes: 87108dc78eb8 ("memory: atmel-ebi: Enable the SMC clock if specified")
Signed-off-by: Miaoqian Lin <linmq006@gmail.com>
---
 drivers/memory/atmel-ebi.c | 23 +++++++++++++++++------
 1 file changed, 17 insertions(+), 6 deletions(-)

diff --git a/drivers/memory/atmel-ebi.c b/drivers/memory/atmel-ebi.c
index c267283b01fd..e749dcb3ddea 100644
--- a/drivers/memory/atmel-ebi.c
+++ b/drivers/memory/atmel-ebi.c
@@ -544,20 +544,27 @@ static int atmel_ebi_probe(struct platform_device *pdev)
 	smc_np = of_parse_phandle(dev->of_node, "atmel,smc", 0);
 
 	ebi->smc.regmap = syscon_node_to_regmap(smc_np);
-	if (IS_ERR(ebi->smc.regmap))
-		return PTR_ERR(ebi->smc.regmap);
+	if (IS_ERR(ebi->smc.regmap)) {
+		ret = PTR_ERR(ebi->smc.regmap);
+		goto put_node;
+	}
 
 	ebi->smc.layout = atmel_hsmc_get_reg_layout(smc_np);
-	if (IS_ERR(ebi->smc.layout))
-		return PTR_ERR(ebi->smc.layout);
+	if (IS_ERR(ebi->smc.layout)) {
+		ret = PTR_ERR(ebi->smc.layout);
+		goto put_node;
+	}
 
 	ebi->smc.clk = of_clk_get(smc_np, 0);
 	if (IS_ERR(ebi->smc.clk)) {
-		if (PTR_ERR(ebi->smc.clk) != -ENOENT)
-			return PTR_ERR(ebi->smc.clk);
+		if (PTR_ERR(ebi->smc.clk) != -ENOENT) {
+			ret = PTR_ERR(ebi->smc.clk);
+			goto put_node;
+		}
 
 		ebi->smc.clk = NULL;
 	}
+	of_node_put(smc_np);
 	ret = clk_prepare_enable(ebi->smc.clk);
 	if (ret)
 		return ret;
@@ -608,6 +615,10 @@ static int atmel_ebi_probe(struct platform_device *pdev)
 	}
 
 	return of_platform_populate(np, NULL, NULL, dev);
+
+put_node:
+	of_node_put(smc_np);
+	return ret;
 }
 
 static __maybe_unused int atmel_ebi_resume(struct device *dev)
-- 
2.17.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH] memory: atmel-ebi: Fix missing of_node_put in atmel_ebi_probe
  2022-03-09 11:01 ` Miaoqian Lin
@ 2022-03-18 12:34   ` Claudiu.Beznea
  -1 siblings, 0 replies; 8+ messages in thread
From: Claudiu.Beznea @ 2022-03-18 12:34 UTC (permalink / raw)
  To: linmq006, krzysztof.kozlowski, Nicolas.Ferre, alexandre.belloni,
	bbrezillon, linux-kernel, linux-arm-kernel

On 09.03.2022 13:01, Miaoqian Lin wrote:
> EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe
> 
> The device_node pointer is returned by of_parse_phandle() with refcount
> incremented. We should use of_node_put() on it when done.
> 
> Fixes: 87108dc78eb8 ("memory: atmel-ebi: Enable the SMC clock if specified")
> Signed-off-by: Miaoqian Lin <linmq006@gmail.com>

Reviewed-by: Claudiu Beznea <claudiu.beznea@microchip.com>

> ---
>  drivers/memory/atmel-ebi.c | 23 +++++++++++++++++------
>  1 file changed, 17 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/memory/atmel-ebi.c b/drivers/memory/atmel-ebi.c
> index c267283b01fd..e749dcb3ddea 100644
> --- a/drivers/memory/atmel-ebi.c
> +++ b/drivers/memory/atmel-ebi.c
> @@ -544,20 +544,27 @@ static int atmel_ebi_probe(struct platform_device *pdev)
>         smc_np = of_parse_phandle(dev->of_node, "atmel,smc", 0);
> 
>         ebi->smc.regmap = syscon_node_to_regmap(smc_np);
> -       if (IS_ERR(ebi->smc.regmap))
> -               return PTR_ERR(ebi->smc.regmap);
> +       if (IS_ERR(ebi->smc.regmap)) {
> +               ret = PTR_ERR(ebi->smc.regmap);
> +               goto put_node;
> +       }
> 
>         ebi->smc.layout = atmel_hsmc_get_reg_layout(smc_np);
> -       if (IS_ERR(ebi->smc.layout))
> -               return PTR_ERR(ebi->smc.layout);
> +       if (IS_ERR(ebi->smc.layout)) {
> +               ret = PTR_ERR(ebi->smc.layout);
> +               goto put_node;
> +       }
> 
>         ebi->smc.clk = of_clk_get(smc_np, 0);
>         if (IS_ERR(ebi->smc.clk)) {
> -               if (PTR_ERR(ebi->smc.clk) != -ENOENT)
> -                       return PTR_ERR(ebi->smc.clk);
> +               if (PTR_ERR(ebi->smc.clk) != -ENOENT) {
> +                       ret = PTR_ERR(ebi->smc.clk);
> +                       goto put_node;
> +               }
> 
>                 ebi->smc.clk = NULL;
>         }
> +       of_node_put(smc_np);
>         ret = clk_prepare_enable(ebi->smc.clk);
>         if (ret)
>                 return ret;
> @@ -608,6 +615,10 @@ static int atmel_ebi_probe(struct platform_device *pdev)
>         }
> 
>         return of_platform_populate(np, NULL, NULL, dev);
> +
> +put_node:
> +       of_node_put(smc_np);
> +       return ret;
>  }
> 
>  static __maybe_unused int atmel_ebi_resume(struct device *dev)
> --
> 2.17.1
> 


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

* Re: [PATCH] memory: atmel-ebi: Fix missing of_node_put in atmel_ebi_probe
@ 2022-03-18 12:34   ` Claudiu.Beznea
  0 siblings, 0 replies; 8+ messages in thread
From: Claudiu.Beznea @ 2022-03-18 12:34 UTC (permalink / raw)
  To: linmq006, krzysztof.kozlowski, Nicolas.Ferre, alexandre.belloni,
	bbrezillon, linux-kernel, linux-arm-kernel

On 09.03.2022 13:01, Miaoqian Lin wrote:
> EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe
> 
> The device_node pointer is returned by of_parse_phandle() with refcount
> incremented. We should use of_node_put() on it when done.
> 
> Fixes: 87108dc78eb8 ("memory: atmel-ebi: Enable the SMC clock if specified")
> Signed-off-by: Miaoqian Lin <linmq006@gmail.com>

Reviewed-by: Claudiu Beznea <claudiu.beznea@microchip.com>

> ---
>  drivers/memory/atmel-ebi.c | 23 +++++++++++++++++------
>  1 file changed, 17 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/memory/atmel-ebi.c b/drivers/memory/atmel-ebi.c
> index c267283b01fd..e749dcb3ddea 100644
> --- a/drivers/memory/atmel-ebi.c
> +++ b/drivers/memory/atmel-ebi.c
> @@ -544,20 +544,27 @@ static int atmel_ebi_probe(struct platform_device *pdev)
>         smc_np = of_parse_phandle(dev->of_node, "atmel,smc", 0);
> 
>         ebi->smc.regmap = syscon_node_to_regmap(smc_np);
> -       if (IS_ERR(ebi->smc.regmap))
> -               return PTR_ERR(ebi->smc.regmap);
> +       if (IS_ERR(ebi->smc.regmap)) {
> +               ret = PTR_ERR(ebi->smc.regmap);
> +               goto put_node;
> +       }
> 
>         ebi->smc.layout = atmel_hsmc_get_reg_layout(smc_np);
> -       if (IS_ERR(ebi->smc.layout))
> -               return PTR_ERR(ebi->smc.layout);
> +       if (IS_ERR(ebi->smc.layout)) {
> +               ret = PTR_ERR(ebi->smc.layout);
> +               goto put_node;
> +       }
> 
>         ebi->smc.clk = of_clk_get(smc_np, 0);
>         if (IS_ERR(ebi->smc.clk)) {
> -               if (PTR_ERR(ebi->smc.clk) != -ENOENT)
> -                       return PTR_ERR(ebi->smc.clk);
> +               if (PTR_ERR(ebi->smc.clk) != -ENOENT) {
> +                       ret = PTR_ERR(ebi->smc.clk);
> +                       goto put_node;
> +               }
> 
>                 ebi->smc.clk = NULL;
>         }
> +       of_node_put(smc_np);
>         ret = clk_prepare_enable(ebi->smc.clk);
>         if (ret)
>                 return ret;
> @@ -608,6 +615,10 @@ static int atmel_ebi_probe(struct platform_device *pdev)
>         }
> 
>         return of_platform_populate(np, NULL, NULL, dev);
> +
> +put_node:
> +       of_node_put(smc_np);
> +       return ret;
>  }
> 
>  static __maybe_unused int atmel_ebi_resume(struct device *dev)
> --
> 2.17.1
> 

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH] memory: atmel-ebi: Fix missing of_node_put in atmel_ebi_probe
  2022-03-09 11:01 ` Miaoqian Lin
@ 2022-03-18 12:53   ` Krzysztof Kozlowski
  -1 siblings, 0 replies; 8+ messages in thread
From: Krzysztof Kozlowski @ 2022-03-18 12:53 UTC (permalink / raw)
  To: Miaoqian Lin, Nicolas Ferre, Alexandre Belloni, Claudiu Beznea,
	Boris Brezillon, linux-kernel, linux-arm-kernel

On 09/03/2022 12:01, Miaoqian Lin wrote:
> The device_node pointer is returned by of_parse_phandle() with refcount
> incremented. We should use of_node_put() on it when done.
> 
> Fixes: 87108dc78eb8 ("memory: atmel-ebi: Enable the SMC clock if specified")
> Signed-off-by: Miaoqian Lin <linmq006@gmail.com>
> ---
>  drivers/memory/atmel-ebi.c | 23 +++++++++++++++++------
>  1 file changed, 17 insertions(+), 6 deletions(-)
> 

It's too late for upcoming cycle, so I will pick it up after the merge
window.


Best regards,
Krzysztof

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

* Re: [PATCH] memory: atmel-ebi: Fix missing of_node_put in atmel_ebi_probe
@ 2022-03-18 12:53   ` Krzysztof Kozlowski
  0 siblings, 0 replies; 8+ messages in thread
From: Krzysztof Kozlowski @ 2022-03-18 12:53 UTC (permalink / raw)
  To: Miaoqian Lin, Nicolas Ferre, Alexandre Belloni, Claudiu Beznea,
	Boris Brezillon, linux-kernel, linux-arm-kernel

On 09/03/2022 12:01, Miaoqian Lin wrote:
> The device_node pointer is returned by of_parse_phandle() with refcount
> incremented. We should use of_node_put() on it when done.
> 
> Fixes: 87108dc78eb8 ("memory: atmel-ebi: Enable the SMC clock if specified")
> Signed-off-by: Miaoqian Lin <linmq006@gmail.com>
> ---
>  drivers/memory/atmel-ebi.c | 23 +++++++++++++++++------
>  1 file changed, 17 insertions(+), 6 deletions(-)
> 

It's too late for upcoming cycle, so I will pick it up after the merge
window.


Best regards,
Krzysztof

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH] memory: atmel-ebi: Fix missing of_node_put in atmel_ebi_probe
  2022-03-09 11:01 ` Miaoqian Lin
@ 2022-04-04 17:08   ` Krzysztof Kozlowski
  -1 siblings, 0 replies; 8+ messages in thread
From: Krzysztof Kozlowski @ 2022-04-04 17:08 UTC (permalink / raw)
  To: Krzysztof Kozlowski, Miaoqian Lin, Boris Brezillon,
	Claudiu Beznea, Nicolas Ferre, linux-kernel, Alexandre Belloni,
	linux-arm-kernel
  Cc: Krzysztof Kozlowski

On Wed, 9 Mar 2022 11:01:43 +0000, Miaoqian Lin wrote:
> The device_node pointer is returned by of_parse_phandle() with refcount
> incremented. We should use of_node_put() on it when done.
> 
> 

Applied, thanks!

[1/1] memory: atmel-ebi: Fix missing of_node_put in atmel_ebi_probe
      commit: 6f296a9665ba5ac68937bf11f96214eb9de81baa

Best regards,
-- 
Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH] memory: atmel-ebi: Fix missing of_node_put in atmel_ebi_probe
@ 2022-04-04 17:08   ` Krzysztof Kozlowski
  0 siblings, 0 replies; 8+ messages in thread
From: Krzysztof Kozlowski @ 2022-04-04 17:08 UTC (permalink / raw)
  To: Krzysztof Kozlowski, Miaoqian Lin, Boris Brezillon,
	Claudiu Beznea, Nicolas Ferre, linux-kernel, Alexandre Belloni,
	linux-arm-kernel
  Cc: Krzysztof Kozlowski

On Wed, 9 Mar 2022 11:01:43 +0000, Miaoqian Lin wrote:
> The device_node pointer is returned by of_parse_phandle() with refcount
> incremented. We should use of_node_put() on it when done.
> 
> 

Applied, thanks!

[1/1] memory: atmel-ebi: Fix missing of_node_put in atmel_ebi_probe
      commit: 6f296a9665ba5ac68937bf11f96214eb9de81baa

Best regards,
-- 
Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>

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

end of thread, other threads:[~2022-04-04 21:23 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-09 11:01 [PATCH] memory: atmel-ebi: Fix missing of_node_put in atmel_ebi_probe Miaoqian Lin
2022-03-09 11:01 ` Miaoqian Lin
2022-03-18 12:34 ` Claudiu.Beznea
2022-03-18 12:34   ` Claudiu.Beznea
2022-03-18 12:53 ` Krzysztof Kozlowski
2022-03-18 12:53   ` Krzysztof Kozlowski
2022-04-04 17:08 ` Krzysztof Kozlowski
2022-04-04 17:08   ` Krzysztof Kozlowski

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.