diff mbox series

clk: imx93: Fix an error code assignment in imx93_clocks_probe()

Message ID cf7b69f4-c4b2-5160-e19a-14c272b0dc6e@web.de (mailing list archive)
State New, archived
Headers show
Series clk: imx93: Fix an error code assignment in imx93_clocks_probe() | expand

Commit Message

Markus Elfring June 13, 2023, 8:12 p.m. UTC
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(-)

--
2.41.0

Comments

Peng Fan June 14, 2023, 1:56 a.m. UTC | #1
> 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
Markus Elfring Jan. 5, 2024, 8 p.m. UTC | #2
> 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
diff mbox series

Patch

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;
 	}