Skip to content
Commit 878b02d5 authored by Yuxing Liu's avatar Yuxing Liu Committed by Abel Vesa
Browse files

clk: imx: clk-imx8mp: improve error handling in imx8mp_clocks_probe()



Replace of_iomap() and kzalloc() with devm_of_iomap() and devm_kzalloc()
which can automatically release the related memory when the device
or driver is removed or unloaded to avoid potential memory leak.

In this case, iounmap(anatop_base) in line 427,433 are removed
as manual release is not required.

Besides, referring to clk-imx8mq.c, check the return code of
of_clk_add_hw_provider, if it returns negtive, print error info
and unregister hws, which makes the program more robust.

Fixes: 9c140d99 ("clk: imx: Add support for i.MX8MP clock driver")
Signed-off-by: default avatarYuxing Liu <lyx2022@hust.edu.cn>
Reviewed-by: default avatarDongliang Mu <dzm91@hust.edu.cn>
Reviewed-by: default avatarAbel Vesa <abel.vesa@linaro.org>
Link: https://lore.kernel.org/r/20230503070607.2462-1-lyx2022@hust.edu.cn


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