]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commit
clk: imx: clk-imxrt1050: fix memory leak in imxrt1050_clocks_probe
authorKai Ma <kaima@hust.edu.cn>
Tue, 18 Apr 2023 11:34:51 +0000 (11:34 +0000)
committerRoxana Nicolescu <roxana.nicolescu@canonical.com>
Mon, 2 Oct 2023 15:19:45 +0000 (17:19 +0200)
commit7b0737c55ce3cf4345b2e5c9b308db954bb6790b
tree2b5b54bd3be23bbcbcb278cde8d711278bae434b
parent8131f793253891fa28268252a2a7817e039381f9
clk: imx: clk-imxrt1050: fix memory leak in imxrt1050_clocks_probe

BugLink: https://bugs.launchpad.net/bugs/2034469
[ Upstream commit 1b280598ab3bd8a2dc8b96a12530d5b1ee7a8f4a ]

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