All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] clk: imx93: fix memory leak and missing unwind goto in imx93_clocks_probe
@ 2023-06-01  3:38 ` Zhanhao Hu
  0 siblings, 0 replies; 11+ messages in thread
From: Zhanhao Hu @ 2023-06-01  3:38 UTC (permalink / raw)
  To: Abel Vesa, Peng Fan, Michael Turquette, Stephen Boyd, Shawn Guo,
	Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
	NXP Linux Team
  Cc: hust-os-kernel-patches, Zhanhao Hu, linux-clk, linux-arm-kernel,
	linux-kernel

In function probe(), it returns directly without unregistered hws
when error occurs.

Fix this by adding 'goto unregister_hws;' on line 295 and
line 310.

Use devm_kzalloc() instead of kzalloc() to automatically
free the memory using devm_kfree() when error occurs.

Replace of_iomap() with devm_of_iomap() to automatically
handle the unused ioremap region and delete 'iounmap(anatop_base);'
in unregister_hws.

Fixes: 24defbe194b6 ("clk: imx: add i.MX93 clk")
Signed-off-by: Zhanhao Hu <zero12113@hust.edu.cn>
---
V1 -> V2 : Rephrase commit message in imperative mood.
This issue is found by static analysis and remains untested.
---
 drivers/clk/imx/clk-imx93.c | 15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)

diff --git a/drivers/clk/imx/clk-imx93.c b/drivers/clk/imx/clk-imx93.c
index 07b4a043e449..b6c7c2725906 100644
--- a/drivers/clk/imx/clk-imx93.c
+++ b/drivers/clk/imx/clk-imx93.c
@@ -264,7 +264,7 @@ static int imx93_clocks_probe(struct platform_device *pdev)
 	void __iomem *base, *anatop_base;
 	int i, ret;
 
-	clk_hw_data = kzalloc(struct_size(clk_hw_data, hws,
+	clk_hw_data = devm_kzalloc(dev, struct_size(clk_hw_data, hws,
 					  IMX93_CLK_END), GFP_KERNEL);
 	if (!clk_hw_data)
 		return -ENOMEM;
@@ -288,10 +288,12 @@ static int imx93_clocks_probe(struct platform_device *pdev)
 								    "sys_pll_pfd2", 1, 2);
 
 	np = of_find_compatible_node(NULL, NULL, "fsl,imx93-anatop");
-	anatop_base = of_iomap(np, 0);
+	anatop_base = devm_of_iomap(dev, np, 0, NULL);
 	of_node_put(np);
-	if (WARN_ON(!anatop_base))
-		return -ENOMEM;
+	if (WARN_ON(IS_ERR(anatop_base))) {
+		ret = PTR_ERR(base);
+		goto unregister_hws;
+	}
 
 	clks[IMX93_CLK_ARM_PLL] = imx_clk_fracn_gppll_integer("arm_pll", "osc_24m",
 							      anatop_base + 0x1000,
@@ -304,8 +306,8 @@ static int imx93_clocks_probe(struct platform_device *pdev)
 	np = dev->of_node;
 	base = devm_platform_ioremap_resource(pdev, 0);
 	if (WARN_ON(IS_ERR(base))) {
-		iounmap(anatop_base);
-		return PTR_ERR(base);
+		ret = PTR_ERR(base);
+		goto unregister_hws;
 	}
 
 	for (i = 0; i < ARRAY_SIZE(root_array); i++) {
@@ -345,7 +347,6 @@ static int imx93_clocks_probe(struct platform_device *pdev)
 
 unregister_hws:
 	imx_unregister_hw_clocks(clks, IMX93_CLK_END);
-	iounmap(anatop_base);
 
 	return ret;
 }
-- 
2.34.1


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

* [PATCH v2] clk: imx93: fix memory leak and missing unwind goto in imx93_clocks_probe
@ 2023-06-01  3:38 ` Zhanhao Hu
  0 siblings, 0 replies; 11+ messages in thread
From: Zhanhao Hu @ 2023-06-01  3:38 UTC (permalink / raw)
  To: Abel Vesa, Peng Fan, Michael Turquette, Stephen Boyd, Shawn Guo,
	Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
	NXP Linux Team
  Cc: hust-os-kernel-patches, Zhanhao Hu, linux-clk, linux-arm-kernel,
	linux-kernel

In function probe(), it returns directly without unregistered hws
when error occurs.

Fix this by adding 'goto unregister_hws;' on line 295 and
line 310.

Use devm_kzalloc() instead of kzalloc() to automatically
free the memory using devm_kfree() when error occurs.

Replace of_iomap() with devm_of_iomap() to automatically
handle the unused ioremap region and delete 'iounmap(anatop_base);'
in unregister_hws.

Fixes: 24defbe194b6 ("clk: imx: add i.MX93 clk")
Signed-off-by: Zhanhao Hu <zero12113@hust.edu.cn>
---
V1 -> V2 : Rephrase commit message in imperative mood.
This issue is found by static analysis and remains untested.
---
 drivers/clk/imx/clk-imx93.c | 15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)

diff --git a/drivers/clk/imx/clk-imx93.c b/drivers/clk/imx/clk-imx93.c
index 07b4a043e449..b6c7c2725906 100644
--- a/drivers/clk/imx/clk-imx93.c
+++ b/drivers/clk/imx/clk-imx93.c
@@ -264,7 +264,7 @@ static int imx93_clocks_probe(struct platform_device *pdev)
 	void __iomem *base, *anatop_base;
 	int i, ret;
 
-	clk_hw_data = kzalloc(struct_size(clk_hw_data, hws,
+	clk_hw_data = devm_kzalloc(dev, struct_size(clk_hw_data, hws,
 					  IMX93_CLK_END), GFP_KERNEL);
 	if (!clk_hw_data)
 		return -ENOMEM;
@@ -288,10 +288,12 @@ static int imx93_clocks_probe(struct platform_device *pdev)
 								    "sys_pll_pfd2", 1, 2);
 
 	np = of_find_compatible_node(NULL, NULL, "fsl,imx93-anatop");
-	anatop_base = of_iomap(np, 0);
+	anatop_base = devm_of_iomap(dev, np, 0, NULL);
 	of_node_put(np);
-	if (WARN_ON(!anatop_base))
-		return -ENOMEM;
+	if (WARN_ON(IS_ERR(anatop_base))) {
+		ret = PTR_ERR(base);
+		goto unregister_hws;
+	}
 
 	clks[IMX93_CLK_ARM_PLL] = imx_clk_fracn_gppll_integer("arm_pll", "osc_24m",
 							      anatop_base + 0x1000,
@@ -304,8 +306,8 @@ static int imx93_clocks_probe(struct platform_device *pdev)
 	np = dev->of_node;
 	base = devm_platform_ioremap_resource(pdev, 0);
 	if (WARN_ON(IS_ERR(base))) {
-		iounmap(anatop_base);
-		return PTR_ERR(base);
+		ret = PTR_ERR(base);
+		goto unregister_hws;
 	}
 
 	for (i = 0; i < ARRAY_SIZE(root_array); i++) {
@@ -345,7 +347,6 @@ static int imx93_clocks_probe(struct platform_device *pdev)
 
 unregister_hws:
 	imx_unregister_hw_clocks(clks, IMX93_CLK_END);
-	iounmap(anatop_base);
 
 	return ret;
 }
-- 
2.34.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] 11+ messages in thread

* Re: [PATCH v2] clk: imx93: fix memory leak and missing unwind goto in imx93_clocks_probe
  2023-06-01  3:38 ` Zhanhao Hu
  (?)
@ 2023-06-12  8:23 ` Abel Vesa
  -1 siblings, 0 replies; 11+ messages in thread
From: Abel Vesa @ 2023-06-12  8:23 UTC (permalink / raw)
  To: Zhanhao Hu
  Cc: Abel Vesa, Peng Fan, Michael Turquette, Stephen Boyd, Shawn Guo,
	Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
	NXP Linux Team, hust-os-kernel-patches, linux-clk,
	linux-arm-kernel, linux-kernel

On 23-06-01 03:38:25, Zhanhao Hu wrote:
> In function probe(), it returns directly without unregistered hws
> when error occurs.
> 
> Fix this by adding 'goto unregister_hws;' on line 295 and
> line 310.
> 
> Use devm_kzalloc() instead of kzalloc() to automatically
> free the memory using devm_kfree() when error occurs.
> 
> Replace of_iomap() with devm_of_iomap() to automatically
> handle the unused ioremap region and delete 'iounmap(anatop_base);'
> in unregister_hws.
> 
> Fixes: 24defbe194b6 ("clk: imx: add i.MX93 clk")
> Signed-off-by: Zhanhao Hu <zero12113@hust.edu.cn>

Reviewed-by: Abel Vesa <abel.vesa@linaro.org>

> ---
> V1 -> V2 : Rephrase commit message in imperative mood.
> This issue is found by static analysis and remains untested.
> ---
>  drivers/clk/imx/clk-imx93.c | 15 ++++++++-------
>  1 file changed, 8 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/clk/imx/clk-imx93.c b/drivers/clk/imx/clk-imx93.c
> index 07b4a043e449..b6c7c2725906 100644
> --- a/drivers/clk/imx/clk-imx93.c
> +++ b/drivers/clk/imx/clk-imx93.c
> @@ -264,7 +264,7 @@ static int imx93_clocks_probe(struct platform_device *pdev)
>  	void __iomem *base, *anatop_base;
>  	int i, ret;
>  
> -	clk_hw_data = kzalloc(struct_size(clk_hw_data, hws,
> +	clk_hw_data = devm_kzalloc(dev, struct_size(clk_hw_data, hws,
>  					  IMX93_CLK_END), GFP_KERNEL);
>  	if (!clk_hw_data)
>  		return -ENOMEM;
> @@ -288,10 +288,12 @@ static int imx93_clocks_probe(struct platform_device *pdev)
>  								    "sys_pll_pfd2", 1, 2);
>  
>  	np = of_find_compatible_node(NULL, NULL, "fsl,imx93-anatop");
> -	anatop_base = of_iomap(np, 0);
> +	anatop_base = devm_of_iomap(dev, np, 0, NULL);
>  	of_node_put(np);
> -	if (WARN_ON(!anatop_base))
> -		return -ENOMEM;
> +	if (WARN_ON(IS_ERR(anatop_base))) {
> +		ret = PTR_ERR(base);
> +		goto unregister_hws;
> +	}
>  
>  	clks[IMX93_CLK_ARM_PLL] = imx_clk_fracn_gppll_integer("arm_pll", "osc_24m",
>  							      anatop_base + 0x1000,
> @@ -304,8 +306,8 @@ static int imx93_clocks_probe(struct platform_device *pdev)
>  	np = dev->of_node;
>  	base = devm_platform_ioremap_resource(pdev, 0);
>  	if (WARN_ON(IS_ERR(base))) {
> -		iounmap(anatop_base);
> -		return PTR_ERR(base);
> +		ret = PTR_ERR(base);
> +		goto unregister_hws;
>  	}
>  
>  	for (i = 0; i < ARRAY_SIZE(root_array); i++) {
> @@ -345,7 +347,6 @@ static int imx93_clocks_probe(struct platform_device *pdev)
>  
>  unregister_hws:
>  	imx_unregister_hw_clocks(clks, IMX93_CLK_END);
> -	iounmap(anatop_base);
>  
>  	return ret;
>  }
> -- 
> 2.34.1
> 

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

* Re: [PATCH v2] clk: imx93: fix memory leak and missing unwind goto in imx93_clocks_probe
  2023-06-01  3:38 ` Zhanhao Hu
  (?)
  (?)
@ 2023-06-12  9:32 ` Abel Vesa
  -1 siblings, 0 replies; 11+ messages in thread
From: Abel Vesa @ 2023-06-12  9:32 UTC (permalink / raw)
  To: Abel Vesa, Peng Fan, Michael Turquette, Stephen Boyd, Shawn Guo,
	Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
	NXP Linux Team, Zhanhao Hu
  Cc: hust-os-kernel-patches, linux-clk, linux-arm-kernel, linux-kernel


On Thu, 01 Jun 2023 03:38:25 +0000, Zhanhao Hu wrote:
> In function probe(), it returns directly without unregistered hws
> when error occurs.
> 
> Fix this by adding 'goto unregister_hws;' on line 295 and
> line 310.
> 
> Use devm_kzalloc() instead of kzalloc() to automatically
> free the memory using devm_kfree() when error occurs.
> 
> [...]

Applied, thanks!

[1/1] clk: imx93: fix memory leak and missing unwind goto in imx93_clocks_probe
      commit: e02ba11b457647050cb16e7cad16cec3c252fade

Best regards,
-- 
Abel Vesa <abel.vesa@linaro.org>

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

* [cocci] [PATCH] clk: imx93: Fix an error code assignment in imx93_clocks_probe()
  2023-06-01  3:38 ` Zhanhao Hu
@ 2023-06-13 20:12   ` Markus Elfring
  -1 siblings, 0 replies; 11+ messages in thread
From: Markus Elfring @ 2023-06-13 20:12 UTC (permalink / raw)
  To: kernel-janitors, linux-clk, linux-arm-kernel, linux-imx, kernel,
	Abel Vesa, Michael Turquette, Peng Fan, Sascha Hauer, Shawn Guo,
	Stephen Boyd, Zhanhao Hu
  Cc: LKML, cocci

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Tue, 13 Jun 2023 21:50:50 +0200

The variable “base” was passed to a call of the function “PTR_ERR”
in the implementation of the function “imx93_clocks_probe”.
Unfortunately, the variable was not assigned to an error pointer
before this if branch.
Thus use the variable “anatop_base” for an error code assignment instead.

Fixes: e02ba11b4576 ("clk: imx93: fix memory leak and missing unwind goto in imx93_clocks_probe")
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 drivers/clk/imx/clk-imx93.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/clk/imx/clk-imx93.c b/drivers/clk/imx/clk-imx93.c
index b6c7c2725906..44f435103c65 100644
--- a/drivers/clk/imx/clk-imx93.c
+++ b/drivers/clk/imx/clk-imx93.c
@@ -291,7 +291,7 @@ static int imx93_clocks_probe(struct platform_device *pdev)
 	anatop_base = devm_of_iomap(dev, np, 0, NULL);
 	of_node_put(np);
 	if (WARN_ON(IS_ERR(anatop_base))) {
-		ret = PTR_ERR(base);
+		ret = PTR_ERR(anatop_base);
 		goto unregister_hws;
 	}

--
2.41.0


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

* [PATCH] clk: imx93: Fix an error code assignment in imx93_clocks_probe()
@ 2023-06-13 20:12   ` Markus Elfring
  0 siblings, 0 replies; 11+ messages in thread
From: Markus Elfring @ 2023-06-13 20:12 UTC (permalink / raw)
  To: kernel-janitors, linux-clk, linux-arm-kernel, linux-imx, kernel,
	Abel Vesa, Michael Turquette, Peng Fan, Sascha Hauer, Shawn Guo,
	Stephen Boyd, Zhanhao Hu
  Cc: LKML, cocci

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Tue, 13 Jun 2023 21:50:50 +0200

The variable “base” was passed to a call of the function “PTR_ERR”
in the implementation of the function “imx93_clocks_probe”.
Unfortunately, the variable was not assigned to an error pointer
before this if branch.
Thus use the variable “anatop_base” for an error code assignment instead.

Fixes: e02ba11b4576 ("clk: imx93: fix memory leak and missing unwind goto in imx93_clocks_probe")
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 drivers/clk/imx/clk-imx93.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/clk/imx/clk-imx93.c b/drivers/clk/imx/clk-imx93.c
index b6c7c2725906..44f435103c65 100644
--- a/drivers/clk/imx/clk-imx93.c
+++ b/drivers/clk/imx/clk-imx93.c
@@ -291,7 +291,7 @@ static int imx93_clocks_probe(struct platform_device *pdev)
 	anatop_base = devm_of_iomap(dev, np, 0, NULL);
 	of_node_put(np);
 	if (WARN_ON(IS_ERR(anatop_base))) {
-		ret = PTR_ERR(base);
+		ret = PTR_ERR(anatop_base);
 		goto unregister_hws;
 	}

--
2.41.0


_______________________________________________
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] 11+ messages in thread

* RE: [PATCH] clk: imx93: Fix an error code assignment in imx93_clocks_probe()
  2023-06-13 20:12   ` Markus Elfring
@ 2023-06-14  1:56     ` Peng Fan
  -1 siblings, 0 replies; 11+ messages in thread
From: Peng Fan @ 2023-06-14  1:56 UTC (permalink / raw)
  To: Markus Elfring, kernel-janitors, linux-clk, linux-arm-kernel,
	dl-linux-imx, kernel, Abel Vesa, Michael Turquette, Sascha Hauer,
	Shawn Guo, Stephen Boyd, Zhanhao Hu
  Cc: LKML, cocci

> Subject: [PATCH] clk: imx93: Fix an error code assignment in
> imx93_clocks_probe()
> 
> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Tue, 13 Jun 2023 21:50:50 +0200
> 
> The variable “base” was passed to a call of the function “PTR_ERR”
> in the implementation of the function “imx93_clocks_probe”.
> Unfortunately, the variable was not assigned to an error pointer before this
> if branch.
> Thus use the variable “anatop_base” for an error code assignment instead.
> 
> Fixes: e02ba11b4576 ("clk: imx93: fix memory leak and missing unwind goto
> in imx93_clocks_probe")
> Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
> ---
>  drivers/clk/imx/clk-imx93.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/clk/imx/clk-imx93.c b/drivers/clk/imx/clk-imx93.c index
> b6c7c2725906..44f435103c65 100644
> --- a/drivers/clk/imx/clk-imx93.c
> +++ b/drivers/clk/imx/clk-imx93.c
> @@ -291,7 +291,7 @@ static int imx93_clocks_probe(struct
> platform_device *pdev)
>  	anatop_base = devm_of_iomap(dev, np, 0, NULL);
>  	of_node_put(np);
>  	if (WARN_ON(IS_ERR(anatop_base))) {
> -		ret = PTR_ERR(base);
> +		ret = PTR_ERR(anatop_base);
>  		goto unregister_hws;
>  	}
Reviewed-by: Peng Fan <peng.fan@nxp.com>
> 
> --
> 2.41.0


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

* RE: [PATCH] clk: imx93: Fix an error code assignment in imx93_clocks_probe()
@ 2023-06-14  1:56     ` Peng Fan
  0 siblings, 0 replies; 11+ messages in thread
From: Peng Fan @ 2023-06-14  1:56 UTC (permalink / raw)
  To: Markus Elfring, kernel-janitors, linux-clk, linux-arm-kernel,
	dl-linux-imx, kernel, Abel Vesa, Michael Turquette, Sascha Hauer,
	Shawn Guo, Stephen Boyd, Zhanhao Hu
  Cc: LKML, cocci

> Subject: [PATCH] clk: imx93: Fix an error code assignment in
> imx93_clocks_probe()
> 
> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Tue, 13 Jun 2023 21:50:50 +0200
> 
> The variable “base” was passed to a call of the function “PTR_ERR”
> in the implementation of the function “imx93_clocks_probe”.
> Unfortunately, the variable was not assigned to an error pointer before this
> if branch.
> Thus use the variable “anatop_base” for an error code assignment instead.
> 
> Fixes: e02ba11b4576 ("clk: imx93: fix memory leak and missing unwind goto
> in imx93_clocks_probe")
> Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
> ---
>  drivers/clk/imx/clk-imx93.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/clk/imx/clk-imx93.c b/drivers/clk/imx/clk-imx93.c index
> b6c7c2725906..44f435103c65 100644
> --- a/drivers/clk/imx/clk-imx93.c
> +++ b/drivers/clk/imx/clk-imx93.c
> @@ -291,7 +291,7 @@ static int imx93_clocks_probe(struct
> platform_device *pdev)
>  	anatop_base = devm_of_iomap(dev, np, 0, NULL);
>  	of_node_put(np);
>  	if (WARN_ON(IS_ERR(anatop_base))) {
> -		ret = PTR_ERR(base);
> +		ret = PTR_ERR(anatop_base);
>  		goto unregister_hws;
>  	}
Reviewed-by: Peng Fan <peng.fan@nxp.com>
> 
> --
> 2.41.0

_______________________________________________
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] 11+ messages in thread

* Re: [cocci] [PATCH] clk: imx93: Fix an error code assignment in imx93_clocks_probe()
  2023-06-13 20:12   ` Markus Elfring
  (?)
@ 2024-01-05 20:00     ` Markus Elfring
  -1 siblings, 0 replies; 11+ messages in thread
From: Markus Elfring @ 2024-01-05 20:00 UTC (permalink / raw)
  To: kernel-janitors, linux-clk, linux-arm-kernel, linux-imx, kernel,
	Abel Vesa, Michael Turquette, Peng Fan, Sascha Hauer, Shawn Guo,
	Stephen Boyd, Zhanhao Hu
  Cc: LKML, cocci

> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Tue, 13 Jun 2023 21:50:50 +0200
>
> The variable “base” was passed to a call of the function “PTR_ERR”
> in the implementation of the function “imx93_clocks_probe”.
> Unfortunately, the variable was not assigned to an error pointer
> before this if branch.
> Thus use the variable “anatop_base” for an error code assignment instead.
>
> Fixes: e02ba11b4576 ("clk: imx93: fix memory leak and missing unwind goto in imx93_clocks_probe")
> Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
> ---
>  drivers/clk/imx/clk-imx93.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/clk/imx/clk-imx93.c b/drivers/clk/imx/clk-imx93.c
> index b6c7c2725906..44f435103c65 100644
> --- a/drivers/clk/imx/clk-imx93.c
> +++ b/drivers/clk/imx/clk-imx93.c
> @@ -291,7 +291,7 @@ static int imx93_clocks_probe(struct platform_device *pdev)
>  	anatop_base = devm_of_iomap(dev, np, 0, NULL);
>  	of_node_put(np);
>  	if (WARN_ON(IS_ERR(anatop_base))) {
> -		ret = PTR_ERR(base);
> +		ret = PTR_ERR(anatop_base);
>  		goto unregister_hws;
>  	}
>

Is this patch still in review queues?

See also:
https://lore.kernel.org/cocci/cf7b69f4-c4b2-5160-e19a-14c272b0dc6e@web.de/
https://sympa.inria.fr/sympa/arc/cocci/2023-06/msg00016.html

Regards,
Markus

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

* Re: [PATCH] clk: imx93: Fix an error code assignment in imx93_clocks_probe()
@ 2024-01-05 20:00     ` Markus Elfring
  0 siblings, 0 replies; 11+ messages in thread
From: Markus Elfring @ 2024-01-05 20:00 UTC (permalink / raw)
  To: kernel-janitors, linux-clk, linux-arm-kernel, linux-imx, kernel,
	Abel Vesa, Michael Turquette, Peng Fan, Sascha Hauer, Shawn Guo,
	Stephen Boyd, Zhanhao Hu
  Cc: LKML, cocci

> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Tue, 13 Jun 2023 21:50:50 +0200
>
> The variable “base” was passed to a call of the function “PTR_ERR”
> in the implementation of the function “imx93_clocks_probe”.
> Unfortunately, the variable was not assigned to an error pointer
> before this if branch.
> Thus use the variable “anatop_base” for an error code assignment instead.
>
> Fixes: e02ba11b4576 ("clk: imx93: fix memory leak and missing unwind goto in imx93_clocks_probe")
> Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
> ---
>  drivers/clk/imx/clk-imx93.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/clk/imx/clk-imx93.c b/drivers/clk/imx/clk-imx93.c
> index b6c7c2725906..44f435103c65 100644
> --- a/drivers/clk/imx/clk-imx93.c
> +++ b/drivers/clk/imx/clk-imx93.c
> @@ -291,7 +291,7 @@ static int imx93_clocks_probe(struct platform_device *pdev)
>  	anatop_base = devm_of_iomap(dev, np, 0, NULL);
>  	of_node_put(np);
>  	if (WARN_ON(IS_ERR(anatop_base))) {
> -		ret = PTR_ERR(base);
> +		ret = PTR_ERR(anatop_base);
>  		goto unregister_hws;
>  	}
>

Is this patch still in review queues?

See also:
https://lore.kernel.org/cocci/cf7b69f4-c4b2-5160-e19a-14c272b0dc6e@web.de/
https://sympa.inria.fr/sympa/arc/cocci/2023-06/msg00016.html

Regards,
Markus

_______________________________________________
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] 11+ messages in thread

* Re: [PATCH] clk: imx93: Fix an error code assignment in imx93_clocks_probe()
@ 2024-01-05 20:00     ` Markus Elfring
  0 siblings, 0 replies; 11+ messages in thread
From: Markus Elfring @ 2024-01-05 20:00 UTC (permalink / raw)
  To: kernel-janitors, linux-clk, linux-arm-kernel, linux-imx, kernel,
	Abel Vesa, Michael Turquette, Peng Fan, Sascha Hauer, Shawn Guo,
	Stephen Boyd, Zhanhao Hu
  Cc: LKML, cocci

> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Tue, 13 Jun 2023 21:50:50 +0200
>
> The variable “base” was passed to a call of the function “PTR_ERR”
> in the implementation of the function “imx93_clocks_probe”.
> Unfortunately, the variable was not assigned to an error pointer
> before this if branch.
> Thus use the variable “anatop_base” for an error code assignment instead.
>
> Fixes: e02ba11b4576 ("clk: imx93: fix memory leak and missing unwind goto in imx93_clocks_probe")
> Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
> ---
>  drivers/clk/imx/clk-imx93.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/clk/imx/clk-imx93.c b/drivers/clk/imx/clk-imx93.c
> index b6c7c2725906..44f435103c65 100644
> --- a/drivers/clk/imx/clk-imx93.c
> +++ b/drivers/clk/imx/clk-imx93.c
> @@ -291,7 +291,7 @@ static int imx93_clocks_probe(struct platform_device *pdev)
>  	anatop_base = devm_of_iomap(dev, np, 0, NULL);
>  	of_node_put(np);
>  	if (WARN_ON(IS_ERR(anatop_base))) {
> -		ret = PTR_ERR(base);
> +		ret = PTR_ERR(anatop_base);
>  		goto unregister_hws;
>  	}
>

Is this patch still in review queues?

See also:
https://lore.kernel.org/cocci/cf7b69f4-c4b2-5160-e19a-14c272b0dc6e@web.de/
https://sympa.inria.fr/sympa/arc/cocci/2023-06/msg00016.html

Regards,
Markus

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

end of thread, other threads:[~2024-01-05 20:01 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-06-01  3:38 [PATCH v2] clk: imx93: fix memory leak and missing unwind goto in imx93_clocks_probe Zhanhao Hu
2023-06-01  3:38 ` Zhanhao Hu
2023-06-12  8:23 ` Abel Vesa
2023-06-12  9:32 ` Abel Vesa
2023-06-13 20:12 ` [cocci] [PATCH] clk: imx93: Fix an error code assignment in imx93_clocks_probe() Markus Elfring
2023-06-13 20:12   ` Markus Elfring
2023-06-14  1:56   ` Peng Fan
2023-06-14  1:56     ` Peng Fan
2024-01-05 20:00   ` [cocci] " Markus Elfring
2024-01-05 20:00     ` Markus Elfring
2024-01-05 20:00     ` Markus Elfring

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.