linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] clk: imx93: Propagate correct error in imx93_clocks_probe()
@ 2023-07-11 15:08 Geert Uytterhoeven
  2023-07-12  0:39 ` Peng Fan
  2023-07-19 21:05 ` Stephen Boyd
  0 siblings, 2 replies; 3+ messages in thread
From: Geert Uytterhoeven @ 2023-07-11 15:08 UTC (permalink / raw)
  To: Zhanhao Hu, Abel Vesa, Dan Carpenter, Peng Fan, Michael Turquette,
	Stephen Boyd, Shawn Guo, Sascha Hauer, Pengutronix Kernel Team,
	Fabio Estevam
  Cc: NXP Linux Team, kernel test robot, linux-clk, linux-arm-kernel,
	linux-kernel, Geert Uytterhoeven

smatch reports:

    drivers/clk/imx/clk-imx93.c:294 imx93_clocks_probe() error: uninitialized symbol 'base'.

Indeed, in case of an error, the wrong (yet uninitialized) variable is
converted to an error code and returned.
Fix this by propagating the error code in the correct variable.

Fixes: e02ba11b45764705 ("clk: imx93: fix memory leak and missing unwind goto in imx93_clocks_probe")
Reported-by: Dan Carpenter <dan.carpenter@linaro.org>
Closes: https://lore.kernel.org/all/9c2acd81-3ad8-485d-819e-9e4201277831@kadam.mountain
Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/all/202306161533.4YDmL22b-lkp@intel.com/
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
---
 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 b6c7c2725906c574..44f435103c65a8ee 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.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] 3+ messages in thread

* RE: [PATCH] clk: imx93: Propagate correct error in imx93_clocks_probe()
  2023-07-11 15:08 [PATCH] clk: imx93: Propagate correct error in imx93_clocks_probe() Geert Uytterhoeven
@ 2023-07-12  0:39 ` Peng Fan
  2023-07-19 21:05 ` Stephen Boyd
  1 sibling, 0 replies; 3+ messages in thread
From: Peng Fan @ 2023-07-12  0:39 UTC (permalink / raw)
  To: Geert Uytterhoeven, Zhanhao Hu, Abel Vesa, Dan Carpenter,
	Michael Turquette, Stephen Boyd, Shawn Guo, Sascha Hauer,
	Pengutronix Kernel Team, Fabio Estevam
  Cc: dl-linux-imx, kernel test robot, linux-clk@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org



> -----Original Message-----
> From: Geert Uytterhoeven <geert+renesas@glider.be>
> Sent: 2023年7月11日 23:08
> To: Zhanhao Hu <zero12113@hust.edu.cn>; Abel Vesa
> <abelvesa@kernel.org>; Dan Carpenter <dan.carpenter@linaro.org>; Peng
> Fan <peng.fan@nxp.com>; Michael Turquette <mturquette@baylibre.com>;
> Stephen Boyd <sboyd@kernel.org>; Shawn Guo <shawnguo@kernel.org>;
> Sascha Hauer <s.hauer@pengutronix.de>; Pengutronix Kernel Team
> <kernel@pengutronix.de>; Fabio Estevam <festevam@gmail.com>
> Cc: dl-linux-imx <linux-imx@nxp.com>; kernel test robot <lkp@intel.com>;
> linux-clk@vger.kernel.org; linux-arm-kernel@lists.infradead.org; linux-
> kernel@vger.kernel.org; Geert Uytterhoeven <geert+renesas@glider.be>
> Subject: [PATCH] clk: imx93: Propagate correct error in imx93_clocks_probe()
> 
> smatch reports:
> 
>     drivers/clk/imx/clk-imx93.c:294 imx93_clocks_probe() error: uninitialized
> symbol 'base'.
> 
> Indeed, in case of an error, the wrong (yet uninitialized) variable is
> converted to an error code and returned.
> Fix this by propagating the error code in the correct variable.
> 
> Fixes: e02ba11b45764705 ("clk: imx93: fix memory leak and missing unwind
> goto in imx93_clocks_probe")
> Reported-by: Dan Carpenter <dan.carpenter@linaro.org>
> Closes:
> https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Flore.
> kernel.org%2Fall%2F9c2acd81-3ad8-485d-819e-
> 9e4201277831%40kadam.mountain&data=05%7C01%7Cpeng.fan%40nxp.co
> m%7Caac4262700fd4d8926c808db8220abe8%7C686ea1d3bc2b4c6fa92cd99
> c5c301635%7C0%7C0%7C638246849056820470%7CUnknown%7CTWFpbGZs
> b3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6M
> n0%3D%7C3000%7C%7C%7C&sdata=fBtWgLEciWjDlsr9sklMJ%2BgQ9WVgBl
> q%2FdSK92so0K0E%3D&reserved=0
> Reported-by: kernel test robot <lkp@intel.com>
> Closes:
> https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Flore.
> kernel.org%2Fall%2F202306161533.4YDmL22b-
> lkp%40intel.com%2F&data=05%7C01%7Cpeng.fan%40nxp.com%7Caac4262
> 700fd4d8926c808db8220abe8%7C686ea1d3bc2b4c6fa92cd99c5c301635%7C
> 0%7C0%7C638246849056820470%7CUnknown%7CTWFpbGZsb3d8eyJWIjoi
> MC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C30
> 00%7C%7C%7C&sdata=bwieb46snU2Z7WCVS3ca4sqKyF%2FV0axCXokIAgVr
> dGY%3D&reserved=0
> Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
> ---
>  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
> b6c7c2725906c574..44f435103c65a8ee 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.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	[flat|nested] 3+ messages in thread

* Re: [PATCH] clk: imx93: Propagate correct error in imx93_clocks_probe()
  2023-07-11 15:08 [PATCH] clk: imx93: Propagate correct error in imx93_clocks_probe() Geert Uytterhoeven
  2023-07-12  0:39 ` Peng Fan
@ 2023-07-19 21:05 ` Stephen Boyd
  1 sibling, 0 replies; 3+ messages in thread
From: Stephen Boyd @ 2023-07-19 21:05 UTC (permalink / raw)
  To: Abel Vesa, Dan Carpenter, Fabio Estevam, Geert Uytterhoeven,
	Michael Turquette, Peng Fan, Pengutronix Kernel Team,
	Sascha Hauer, Shawn Guo, Zhanhao Hu
  Cc: NXP Linux Team, kernel test robot, linux-clk, linux-arm-kernel,
	linux-kernel, Geert Uytterhoeven

Quoting Geert Uytterhoeven (2023-07-11 08:08:12)
> smatch reports:
> 
>     drivers/clk/imx/clk-imx93.c:294 imx93_clocks_probe() error: uninitialized symbol 'base'.
> 
> Indeed, in case of an error, the wrong (yet uninitialized) variable is
> converted to an error code and returned.
> Fix this by propagating the error code in the correct variable.
> 
> Fixes: e02ba11b45764705 ("clk: imx93: fix memory leak and missing unwind goto in imx93_clocks_probe")
> Reported-by: Dan Carpenter <dan.carpenter@linaro.org>
> Closes: https://lore.kernel.org/all/9c2acd81-3ad8-485d-819e-9e4201277831@kadam.mountain
> Reported-by: kernel test robot <lkp@intel.com>
> Closes: https://lore.kernel.org/all/202306161533.4YDmL22b-lkp@intel.com/
> Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
> ---

Applied to clk-fixes

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

end of thread, other threads:[~2023-07-19 21:06 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-07-11 15:08 [PATCH] clk: imx93: Propagate correct error in imx93_clocks_probe() Geert Uytterhoeven
2023-07-12  0:39 ` Peng Fan
2023-07-19 21:05 ` Stephen Boyd

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