Skip to content
Commit 1b280598 authored by Kai Ma's avatar Kai Ma Committed by Abel Vesa
Browse files

clk: imx: clk-imxrt1050: fix memory leak in imxrt1050_clocks_probe



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: 7154b046 ("clk: imx: Add initial support for i.MXRT1050 clock driver")
Signed-off-by: default avatarKai Ma <kaima@hust.edu.cn>
Reviewed-by: default avatarPeng Fan <peng.fan@nxp.com>
Acked-by: default avatarJesse Taube <Mr.Bossman075@gmail.com>
Reviewed-by: default avatarAbel Vesa <abel.vesa@linaro.org>
Link: https://lore.kernel.org/r/20230418113451.151312-1-kaima@hust.edu.cn


Signed-off-by: default avatarAbel Vesa <abel.vesa@linaro.org>
parent 8208181f
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment