linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] clk: imx: clk-imxrt1050: fix memory leak in imxrt1050_clocks_probe
@ 2023-04-18 11:34 Kai Ma
  2023-04-18 13:07 ` Jesse Taube
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Kai Ma @ 2023-04-18 11:34 UTC (permalink / raw)
  To: Abel Vesa, Peng Fan, Michael Turquette, Stephen Boyd, Shawn Guo,
	Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
	NXP Linux Team, Jesse Taube
  Cc: hust-os-kernel-patches, Kai Ma, linux-clk, linux-arm-kernel,
	linux-kernel

Use devm_of_iomap() instead of of_iomap() to automatically
handle the unused ioremap region. If any error occurs, regions allocated by
kzalloc() will leak, but using devm_kzalloc() instead will automatically
free the memory using devm_kfree().

Also, fix error handling of hws by adding unregister_hws label, which
unregisters remaining hws when iomap failed.

Fixes: 7154b046d8f3 ("clk: imx: Add initial support for i.MXRT1050 clock driver")
Signed-off-by: Kai Ma <kaima@hust.edu.cn>
---
The issue is found by static analysis and remains untested.
---
 drivers/clk/imx/clk-imxrt1050.c | 22 +++++++++++++++-------
 1 file changed, 15 insertions(+), 7 deletions(-)

diff --git a/drivers/clk/imx/clk-imxrt1050.c b/drivers/clk/imx/clk-imxrt1050.c
index fd5c51fc92c0..08d155feb035 100644
--- a/drivers/clk/imx/clk-imxrt1050.c
+++ b/drivers/clk/imx/clk-imxrt1050.c
@@ -42,7 +42,7 @@ static int imxrt1050_clocks_probe(struct platform_device *pdev)
 	struct device_node *anp;
 	int ret;
 
-	clk_hw_data = kzalloc(struct_size(clk_hw_data, hws,
+	clk_hw_data = devm_kzalloc(dev, struct_size(clk_hw_data, hws,
 					  IMXRT1050_CLK_END), GFP_KERNEL);
 	if (WARN_ON(!clk_hw_data))
 		return -ENOMEM;
@@ -53,10 +53,12 @@ static int imxrt1050_clocks_probe(struct platform_device *pdev)
 	hws[IMXRT1050_CLK_OSC] = imx_get_clk_hw_by_name(np, "osc");
 
 	anp = of_find_compatible_node(NULL, NULL, "fsl,imxrt-anatop");
-	pll_base = of_iomap(anp, 0);
+	pll_base = devm_of_iomap(dev, anp, 0, NULL);
 	of_node_put(anp);
-	if (WARN_ON(!pll_base))
-		return -ENOMEM;
+	if (WARN_ON(IS_ERR(pll_base))) {
+		ret = PTR_ERR(pll_base);
+		goto unregister_hws;
+	}
 
 	/* Anatop clocks */
 	hws[IMXRT1050_CLK_DUMMY] = imx_clk_hw_fixed("dummy", 0UL);
@@ -104,8 +106,10 @@ static int imxrt1050_clocks_probe(struct platform_device *pdev)
 
 	/* CCM clocks */
 	ccm_base = devm_platform_ioremap_resource(pdev, 0);
-	if (WARN_ON(IS_ERR(ccm_base)))
-		return PTR_ERR(ccm_base);
+	if (WARN_ON(IS_ERR(ccm_base))) {
+		ret = PTR_ERR(ccm_base);
+		goto unregister_hws;
+	}
 
 	hws[IMXRT1050_CLK_ARM_PODF] = imx_clk_hw_divider("arm_podf", "pll1_arm", ccm_base + 0x10, 0, 3);
 	hws[IMXRT1050_CLK_PRE_PERIPH_SEL] = imx_clk_hw_mux("pre_periph_sel", ccm_base + 0x18, 18, 2,
@@ -149,8 +153,12 @@ static int imxrt1050_clocks_probe(struct platform_device *pdev)
 	ret = of_clk_add_hw_provider(np, of_clk_hw_onecell_get, clk_hw_data);
 	if (ret < 0) {
 		dev_err(dev, "Failed to register clks for i.MXRT1050.\n");
-		imx_unregister_hw_clocks(hws, IMXRT1050_CLK_END);
+		goto unregister_hws;
 	}
+	return 0;
+
+unregister_hws:
+	imx_unregister_hw_clocks(hws, IMXRT1050_CLK_END);
 	return ret;
 }
 static const struct of_device_id imxrt1050_clk_of_match[] = {
-- 
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] 6+ messages in thread

* Re: [PATCH] clk: imx: clk-imxrt1050: fix memory leak in imxrt1050_clocks_probe
  2023-04-18 11:34 [PATCH] clk: imx: clk-imxrt1050: fix memory leak in imxrt1050_clocks_probe Kai Ma
@ 2023-04-18 13:07 ` Jesse Taube
  2023-04-19  3:02 ` Peng Fan
  2023-05-18 10:34 ` Abel Vesa
  2 siblings, 0 replies; 6+ messages in thread
From: Jesse Taube @ 2023-04-18 13:07 UTC (permalink / raw)
  To: Kai Ma, 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, linux-clk, linux-arm-kernel, linux-kernel



On 4/18/23 07:34, Kai Ma wrote:
> Use devm_of_iomap() instead of of_iomap() to automatically
> handle the unused ioremap region. If any error occurs, regions allocated by
> kzalloc() will leak, but using devm_kzalloc() instead will automatically
> free the memory using devm_kfree().
> 
> Also, fix error handling of hws by adding unregister_hws label, which
> unregisters remaining hws when iomap failed.
> 
> Fixes: 7154b046d8f3 ("clk: imx: Add initial support for i.MXRT1050 clock driver")
> Signed-off-by: Kai Ma <kaima@hust.edu.cn>
> ---
> The issue is found by static analysis and remains untested.
> ---
>  drivers/clk/imx/clk-imxrt1050.c | 22 +++++++++++++++-------
>  1 file changed, 15 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/clk/imx/clk-imxrt1050.c b/drivers/clk/imx/clk-imxrt1050.c
> index fd5c51fc92c0..08d155feb035 100644
> --- a/drivers/clk/imx/clk-imxrt1050.c
> +++ b/drivers/clk/imx/clk-imxrt1050.c
> @@ -42,7 +42,7 @@ static int imxrt1050_clocks_probe(struct platform_device *pdev)
>  	struct device_node *anp;
>  	int ret;
>  
> -	clk_hw_data = kzalloc(struct_size(clk_hw_data, hws,
> +	clk_hw_data = devm_kzalloc(dev, struct_size(clk_hw_data, hws,
>  					  IMXRT1050_CLK_END), GFP_KERNEL);
>  	if (WARN_ON(!clk_hw_data))
>  		return -ENOMEM;
> @@ -53,10 +53,12 @@ static int imxrt1050_clocks_probe(struct platform_device *pdev)
>  	hws[IMXRT1050_CLK_OSC] = imx_get_clk_hw_by_name(np, "osc");
>  
>  	anp = of_find_compatible_node(NULL, NULL, "fsl,imxrt-anatop");
> -	pll_base = of_iomap(anp, 0);
> +	pll_base = devm_of_iomap(dev, anp, 0, NULL);
>  	of_node_put(anp);
> -	if (WARN_ON(!pll_base))
> -		return -ENOMEM;
> +	if (WARN_ON(IS_ERR(pll_base))) {
> +		ret = PTR_ERR(pll_base);
> +		goto unregister_hws;
> +	}
>  
>  	/* Anatop clocks */
>  	hws[IMXRT1050_CLK_DUMMY] = imx_clk_hw_fixed("dummy", 0UL);
> @@ -104,8 +106,10 @@ static int imxrt1050_clocks_probe(struct platform_device *pdev)
>  
>  	/* CCM clocks */
>  	ccm_base = devm_platform_ioremap_resource(pdev, 0);
> -	if (WARN_ON(IS_ERR(ccm_base)))
> -		return PTR_ERR(ccm_base);
> +	if (WARN_ON(IS_ERR(ccm_base))) {
> +		ret = PTR_ERR(ccm_base);
> +		goto unregister_hws;
> +	}
>  
>  	hws[IMXRT1050_CLK_ARM_PODF] = imx_clk_hw_divider("arm_podf", "pll1_arm", ccm_base + 0x10, 0, 3);
>  	hws[IMXRT1050_CLK_PRE_PERIPH_SEL] = imx_clk_hw_mux("pre_periph_sel", ccm_base + 0x18, 18, 2,
> @@ -149,8 +153,12 @@ static int imxrt1050_clocks_probe(struct platform_device *pdev)
>  	ret = of_clk_add_hw_provider(np, of_clk_hw_onecell_get, clk_hw_data);
>  	if (ret < 0) {
>  		dev_err(dev, "Failed to register clks for i.MXRT1050.\n");
> -		imx_unregister_hw_clocks(hws, IMXRT1050_CLK_END);
> +		goto unregister_hws;
>  	}
> +	return 0;
> +
> +unregister_hws:
> +	imx_unregister_hw_clocks(hws, IMXRT1050_CLK_END);
>  	return ret;
>  }
>  static const struct of_device_id imxrt1050_clk_of_match[] = {
Looks good! The fix seems to be similar to how clk-imx8mn.c does this.

Acked-by: Jesse Taube <Mr.Bossman075@gmail.com>

A similar issue seems to also be in drivers/clk/imx/clk-imx8mm.c,clk-imx93.c,clk-imx8mp.c.
Sorry for recreating the issue :(.

Thanks,
Jesse Taube

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

* Re: [PATCH] clk: imx: clk-imxrt1050: fix memory leak in imxrt1050_clocks_probe
  2023-04-18 11:34 [PATCH] clk: imx: clk-imxrt1050: fix memory leak in imxrt1050_clocks_probe Kai Ma
  2023-04-18 13:07 ` Jesse Taube
@ 2023-04-19  3:02 ` Peng Fan
  2023-05-18 10:34 ` Abel Vesa
  2 siblings, 0 replies; 6+ messages in thread
From: Peng Fan @ 2023-04-19  3:02 UTC (permalink / raw)
  To: Kai Ma, Abel Vesa, Peng Fan, Michael Turquette, Stephen Boyd,
	Shawn Guo, Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
	NXP Linux Team, Jesse Taube
  Cc: hust-os-kernel-patches, linux-clk, linux-arm-kernel, linux-kernel



On 4/18/2023 7:34 PM, Kai Ma wrote:
> Use devm_of_iomap() instead of of_iomap() to automatically
> handle the unused ioremap region. If any error occurs, regions allocated by
> kzalloc() will leak, but using devm_kzalloc() instead will automatically
> free the memory using devm_kfree().
> 
> Also, fix error handling of hws by adding unregister_hws label, which
> unregisters remaining hws when iomap failed.
> 
> Fixes: 7154b046d8f3 ("clk: imx: Add initial support for i.MXRT1050 clock driver")
> Signed-off-by: Kai Ma <kaima@hust.edu.cn>

Reviewed-by: Peng Fan <peng.fan@nxp.com>

> ---
> The issue is found by static analysis and remains untested.
> ---
>   drivers/clk/imx/clk-imxrt1050.c | 22 +++++++++++++++-------
>   1 file changed, 15 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/clk/imx/clk-imxrt1050.c b/drivers/clk/imx/clk-imxrt1050.c
> index fd5c51fc92c0..08d155feb035 100644
> --- a/drivers/clk/imx/clk-imxrt1050.c
> +++ b/drivers/clk/imx/clk-imxrt1050.c
> @@ -42,7 +42,7 @@ static int imxrt1050_clocks_probe(struct platform_device *pdev)
>   	struct device_node *anp;
>   	int ret;
>   
> -	clk_hw_data = kzalloc(struct_size(clk_hw_data, hws,
> +	clk_hw_data = devm_kzalloc(dev, struct_size(clk_hw_data, hws,
>   					  IMXRT1050_CLK_END), GFP_KERNEL);
>   	if (WARN_ON(!clk_hw_data))
>   		return -ENOMEM;
> @@ -53,10 +53,12 @@ static int imxrt1050_clocks_probe(struct platform_device *pdev)
>   	hws[IMXRT1050_CLK_OSC] = imx_get_clk_hw_by_name(np, "osc");
>   
>   	anp = of_find_compatible_node(NULL, NULL, "fsl,imxrt-anatop");
> -	pll_base = of_iomap(anp, 0);
> +	pll_base = devm_of_iomap(dev, anp, 0, NULL);
>   	of_node_put(anp);
> -	if (WARN_ON(!pll_base))
> -		return -ENOMEM;
> +	if (WARN_ON(IS_ERR(pll_base))) {
> +		ret = PTR_ERR(pll_base);
> +		goto unregister_hws;
> +	}
>   
>   	/* Anatop clocks */
>   	hws[IMXRT1050_CLK_DUMMY] = imx_clk_hw_fixed("dummy", 0UL);
> @@ -104,8 +106,10 @@ static int imxrt1050_clocks_probe(struct platform_device *pdev)
>   
>   	/* CCM clocks */
>   	ccm_base = devm_platform_ioremap_resource(pdev, 0);
> -	if (WARN_ON(IS_ERR(ccm_base)))
> -		return PTR_ERR(ccm_base);
> +	if (WARN_ON(IS_ERR(ccm_base))) {
> +		ret = PTR_ERR(ccm_base);
> +		goto unregister_hws;
> +	}
>   
>   	hws[IMXRT1050_CLK_ARM_PODF] = imx_clk_hw_divider("arm_podf", "pll1_arm", ccm_base + 0x10, 0, 3);
>   	hws[IMXRT1050_CLK_PRE_PERIPH_SEL] = imx_clk_hw_mux("pre_periph_sel", ccm_base + 0x18, 18, 2,
> @@ -149,8 +153,12 @@ static int imxrt1050_clocks_probe(struct platform_device *pdev)
>   	ret = of_clk_add_hw_provider(np, of_clk_hw_onecell_get, clk_hw_data);
>   	if (ret < 0) {
>   		dev_err(dev, "Failed to register clks for i.MXRT1050.\n");
> -		imx_unregister_hw_clocks(hws, IMXRT1050_CLK_END);
> +		goto unregister_hws;
>   	}
> +	return 0;
> +
> +unregister_hws:
> +	imx_unregister_hw_clocks(hws, IMXRT1050_CLK_END);
>   	return ret;
>   }
>   static const struct of_device_id imxrt1050_clk_of_match[] = {

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

* Re: [PATCH] clk: imx: clk-imxrt1050: fix memory leak in imxrt1050_clocks_probe
  2023-04-18 11:34 [PATCH] clk: imx: clk-imxrt1050: fix memory leak in imxrt1050_clocks_probe Kai Ma
  2023-04-18 13:07 ` Jesse Taube
  2023-04-19  3:02 ` Peng Fan
@ 2023-05-18 10:34 ` Abel Vesa
  2023-05-29  4:55   ` Kai Ma
  2 siblings, 1 reply; 6+ messages in thread
From: Abel Vesa @ 2023-05-18 10:34 UTC (permalink / raw)
  To: Kai Ma, Stephen Boyd
  Cc: Abel Vesa, Peng Fan, Michael Turquette, Stephen Boyd, Shawn Guo,
	Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
	NXP Linux Team, Jesse Taube, hust-os-kernel-patches, linux-clk,
	linux-arm-kernel, linux-kernel

On 23-04-18 11:34:51, Kai Ma wrote:
> Use devm_of_iomap() instead of of_iomap() to automatically
> handle the unused ioremap region. If any error occurs, regions allocated by
> kzalloc() will leak, but using devm_kzalloc() instead will automatically
> free the memory using devm_kfree().
> 
> Also, fix error handling of hws by adding unregister_hws label, which
> unregisters remaining hws when iomap failed.
> 
> Fixes: 7154b046d8f3 ("clk: imx: Add initial support for i.MXRT1050 clock driver")
> Signed-off-by: Kai Ma <kaima@hust.edu.cn>

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

Stephen, can you apply this through clk-fixes?

> ---
> The issue is found by static analysis and remains untested.
> ---
>  drivers/clk/imx/clk-imxrt1050.c | 22 +++++++++++++++-------
>  1 file changed, 15 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/clk/imx/clk-imxrt1050.c b/drivers/clk/imx/clk-imxrt1050.c
> index fd5c51fc92c0..08d155feb035 100644
> --- a/drivers/clk/imx/clk-imxrt1050.c
> +++ b/drivers/clk/imx/clk-imxrt1050.c
> @@ -42,7 +42,7 @@ static int imxrt1050_clocks_probe(struct platform_device *pdev)
>  	struct device_node *anp;
>  	int ret;
>  
> -	clk_hw_data = kzalloc(struct_size(clk_hw_data, hws,
> +	clk_hw_data = devm_kzalloc(dev, struct_size(clk_hw_data, hws,
>  					  IMXRT1050_CLK_END), GFP_KERNEL);
>  	if (WARN_ON(!clk_hw_data))
>  		return -ENOMEM;
> @@ -53,10 +53,12 @@ static int imxrt1050_clocks_probe(struct platform_device *pdev)
>  	hws[IMXRT1050_CLK_OSC] = imx_get_clk_hw_by_name(np, "osc");
>  
>  	anp = of_find_compatible_node(NULL, NULL, "fsl,imxrt-anatop");
> -	pll_base = of_iomap(anp, 0);
> +	pll_base = devm_of_iomap(dev, anp, 0, NULL);
>  	of_node_put(anp);
> -	if (WARN_ON(!pll_base))
> -		return -ENOMEM;
> +	if (WARN_ON(IS_ERR(pll_base))) {
> +		ret = PTR_ERR(pll_base);
> +		goto unregister_hws;
> +	}
>  
>  	/* Anatop clocks */
>  	hws[IMXRT1050_CLK_DUMMY] = imx_clk_hw_fixed("dummy", 0UL);
> @@ -104,8 +106,10 @@ static int imxrt1050_clocks_probe(struct platform_device *pdev)
>  
>  	/* CCM clocks */
>  	ccm_base = devm_platform_ioremap_resource(pdev, 0);
> -	if (WARN_ON(IS_ERR(ccm_base)))
> -		return PTR_ERR(ccm_base);
> +	if (WARN_ON(IS_ERR(ccm_base))) {
> +		ret = PTR_ERR(ccm_base);
> +		goto unregister_hws;
> +	}
>  
>  	hws[IMXRT1050_CLK_ARM_PODF] = imx_clk_hw_divider("arm_podf", "pll1_arm", ccm_base + 0x10, 0, 3);
>  	hws[IMXRT1050_CLK_PRE_PERIPH_SEL] = imx_clk_hw_mux("pre_periph_sel", ccm_base + 0x18, 18, 2,
> @@ -149,8 +153,12 @@ static int imxrt1050_clocks_probe(struct platform_device *pdev)
>  	ret = of_clk_add_hw_provider(np, of_clk_hw_onecell_get, clk_hw_data);
>  	if (ret < 0) {
>  		dev_err(dev, "Failed to register clks for i.MXRT1050.\n");
> -		imx_unregister_hw_clocks(hws, IMXRT1050_CLK_END);
> +		goto unregister_hws;
>  	}
> +	return 0;
> +
> +unregister_hws:
> +	imx_unregister_hw_clocks(hws, IMXRT1050_CLK_END);
>  	return ret;
>  }
>  static const struct of_device_id imxrt1050_clk_of_match[] = {
> -- 
> 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] 6+ messages in thread

* Re: [PATCH] clk: imx: clk-imxrt1050: fix memory leak in imxrt1050_clocks_probe
  2023-05-18 10:34 ` Abel Vesa
@ 2023-05-29  4:55   ` Kai Ma
  2023-05-29 17:54     ` Jesse T
  0 siblings, 1 reply; 6+ messages in thread
From: Kai Ma @ 2023-05-29  4:55 UTC (permalink / raw)
  To: Stephen Boyd, NXP Linux Team
  Cc: Abel Vesa, Peng Fan, Michael Turquette, Stephen Boyd, Shawn Guo,
	Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam, Jesse Taube,
	hust-os-kernel-patches, linux-clk, linux-arm-kernel, linux-kernel,
	Abel Vesa


[-- Attachment #1.1: Type: text/plain, Size: 1392 bytes --]

On Thursday, May 18, 2023 6:34:38 PM CST Abel Vesa wrote:
> On 23-04-18 11:34:51, Kai Ma wrote:
> > Use devm_of_iomap() instead of of_iomap() to automatically
> > handle the unused ioremap region. If any error occurs, regions allocated by
> > kzalloc() will leak, but using devm_kzalloc() instead will automatically
> > free the memory using devm_kfree().
> > 
> > Also, fix error handling of hws by adding unregister_hws label, which
> > unregisters remaining hws when iomap failed.
> > 
> > Fixes: 7154b046d8f3 ("clk: imx: Add initial support for i.MXRT1050 clock driver")
> > Signed-off-by: Kai Ma <kaima@hust.edu.cn>
> 
> Reviewed-by: Abel Vesa <abel.vesa@linaro.org>
> 
> Stephen, can you apply this through clk-fixes?
> 

Thanks for your review, I am glad to let you know that I am a student at a
university and we collaborate to contribute to the Linux kernel. Here we
have some similar patches for clk. Could you please take care of them?

[1] https://lore.kernel.org/linux-arm-kernel/DU0PR04MB9417B63DE97D4A2A77B4176C88969@DU0PR04MB9417.eurprd04.prod.outlook.com/T/
[2] https://lore.kernel.org/linux-arm-kernel/20230503070607.2462-1-lyx2022@hust.edu.cn/T/
[3] https://lore.kernel.org/linux-arm-kernel/dc0f2863-d5d5-5102-eb8e-ceea92c03fda@oss.nxp.com/
[4] https://lore.kernel.org/linux-arm-kernel/9a2ab7ec-07ee-255f-a143-9b6c8df7c1e2@gmail.com/

Thank you very much!

Regards,
Kai Ma

[-- Attachment #1.2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

[-- Attachment #2: Type: text/plain, Size: 176 bytes --]

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

* Re: [PATCH] clk: imx: clk-imxrt1050: fix memory leak in imxrt1050_clocks_probe
  2023-05-29  4:55   ` Kai Ma
@ 2023-05-29 17:54     ` Jesse T
  0 siblings, 0 replies; 6+ messages in thread
From: Jesse T @ 2023-05-29 17:54 UTC (permalink / raw)
  To: Kai Ma
  Cc: Stephen Boyd, NXP Linux Team, Abel Vesa, Peng Fan,
	Michael Turquette, Shawn Guo, Sascha Hauer,
	Pengutronix Kernel Team, Fabio Estevam, hust-os-kernel-patches,
	linux-clk, linux-arm-kernel, linux-kernel, Abel Vesa,
	Dongliang Mu, Zhanhao Hu

On Mon, May 29, 2023 at 12:55 AM Kai Ma <kaima@hust.edu.cn> wrote:
>
> On Thursday, May 18, 2023 6:34:38 PM CST Abel Vesa wrote:
> > On 23-04-18 11:34:51, Kai Ma wrote:
> > > Use devm_of_iomap() instead of of_iomap() to automatically
> > > handle the unused ioremap region. If any error occurs, regions allocated by
> > > kzalloc() will leak, but using devm_kzalloc() instead will automatically
> > > free the memory using devm_kfree().
> > >
> > > Also, fix error handling of hws by adding unregister_hws label, which
> > > unregisters remaining hws when iomap failed.
> > >
> > > Fixes: 7154b046d8f3 ("clk: imx: Add initial support for i.MXRT1050 clock driver")
> > > Signed-off-by: Kai Ma <kaima@hust.edu.cn>
> >
> > Reviewed-by: Abel Vesa <abel.vesa@linaro.org>
> >
> > Stephen, can you apply this through clk-fixes?
> >
>
> Thanks for your review, I am glad to let you know that I am a student at a
> university and we collaborate to contribute to the Linux kernel.

That's cool, I am too!
Is there going to be a V2 of
https://lore.kernel.org/linux-arm-kernel/20230426142552.217435-1-zero12113@hust.edu.cn/T/

Thanks,
Jesse Taube

> Here we
> have some similar patches for clk. Could you please take care of them?
>
> [1] https://lore.kernel.org/linux-arm-kernel/DU0PR04MB9417B63DE97D4A2A77B4176C88969@DU0PR04MB9417.eurprd04.prod.outlook.com/T/
> [2] https://lore.kernel.org/linux-arm-kernel/20230503070607.2462-1-lyx2022@hust.edu.cn/T/
> [3] https://lore.kernel.org/linux-arm-kernel/dc0f2863-d5d5-5102-eb8e-ceea92c03fda@oss.nxp.com/
> [4] https://lore.kernel.org/linux-arm-kernel/9a2ab7ec-07ee-255f-a143-9b6c8df7c1e2@gmail.com/
>
> Thank you very much!
>
> Regards,
> Kai Ma

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

end of thread, other threads:[~2023-05-29 17:55 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-04-18 11:34 [PATCH] clk: imx: clk-imxrt1050: fix memory leak in imxrt1050_clocks_probe Kai Ma
2023-04-18 13:07 ` Jesse Taube
2023-04-19  3:02 ` Peng Fan
2023-05-18 10:34 ` Abel Vesa
2023-05-29  4:55   ` Kai Ma
2023-05-29 17:54     ` Jesse T

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