]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commit
clk: imx: clk-imx8mp: improve error handling in imx8mp_clocks_probe()
authorYuxing Liu <lyx2022@hust.edu.cn>
Wed, 3 May 2023 07:06:07 +0000 (07:06 +0000)
committerRoxana Nicolescu <roxana.nicolescu@canonical.com>
Mon, 2 Oct 2023 15:19:45 +0000 (17:19 +0200)
commita52935db00f6f0705378901601ce59dd3ce46af6
treebe754bf06da58bb4c5124fedc9e6396291f09328
parentc6e98525429d559ec1499545964594d5cbaa18bb
clk: imx: clk-imx8mp: improve error handling in imx8mp_clocks_probe()

BugLink: https://bugs.launchpad.net/bugs/2034469
[ Upstream commit 878b02d5f3b56cb090dbe2c70c89273be144087f ]

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: 9c140d992676 ("clk: imx: Add support for i.MX8MP clock driver")
Signed-off-by: Yuxing Liu <lyx2022@hust.edu.cn>
Reviewed-by: Dongliang Mu <dzm91@hust.edu.cn>
Reviewed-by: Abel Vesa <abel.vesa@linaro.org>
Link: https://lore.kernel.org/r/20230503070607.2462-1-lyx2022@hust.edu.cn
Signed-off-by: Abel Vesa <abel.vesa@linaro.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Stefan Bader <stefan.bader@canonical.com>
drivers/clk/imx/clk-imx8mp.c