Messages in this thread | | | Date | Fri, 28 Apr 2023 15:49:18 +0800 | Subject | Re: [PATCH] clk: imx93: fix memory leak and missing unwind goto in imx93_clocks_probe | From | Peng Fan <> |
| |
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>
| |