lkml.org 
[lkml]   [2023]   [Apr]   [28]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
SubjectRe: [PATCH] clk: imx93: fix memory leak and missing unwind goto in imx93_clocks_probe
From


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@hust.edu.cn>
> Reviewed-by: Dongliang Mu<dzm91@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@nxp.com>

\
 
 \ /
  Last update: 2023-04-28 09:51    [W:0.082 / U:0.684 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site