[PATCH] clk: imx93: fix memory leak and missing unwind goto in imx93_clocks_probe

Peng Fan peng.fan at oss.nxp.com
Fri Apr 28 00:49:18 PDT 2023



On 4/26/2023 10:25 PM, Zhanhao Hu wrote:
> In function probe(), it returns directly without unregistered hws
> when error occurs.
> 
> I fix this by adding 'goto unregister_hws;' on line 295 and
> line 310.
> 
> Besides, I use devm_kzalloc() instead of kzalloc() to automatically
> free the memory using devm_kfree() when error occurs.
> 
> Similarly, I replace of_iomap() with devm_of_iomap() to automatically
> handle the unused ioremap region. So I delete 'iounmap(anatop_base);'
> in unregister_hws.
> 
> Fixes: 24defbe194b6 ("clk: imx: add i.MX93 clk")
> Signed-off-by: Zhanhao Hu<zero12113 at hust.edu.cn>
> Reviewed-by: Dongliang Mu<dzm91 at hust.edu.cn>

Actually the clk driver should never fail, otherwise the system will not 
boot. But anyway it is fine to include the changes:

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



More information about the linux-arm-kernel mailing list