clk: imx: clk-imx8mn: fix memory leak in imx8mn_clocks_probe
authorHao Luo <m202171776@hust.edu.cn>
Tue, 11 Apr 2023 01:51:07 +0000 (09:51 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 19 Jul 2023 14:21:29 +0000 (16:21 +0200)
commit9ba3693b0350b154fdd7830559bbc7b04c067096
treef0f306ca4fc6bc8a8ca6c86bfe315644ecd2144f
parent1839032251a66f2ae5a043c495532830a55d28c4
clk: imx: clk-imx8mn: fix memory leak in imx8mn_clocks_probe

[ Upstream commit 188d070de9132667956f5aadd98d2bd87d3eac89 ]

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().

Fixes: daeb14545514 ("clk: imx: imx8mn: Switch to clk_hw based API")
Fixes: 96d6392b54db ("clk: imx: Add support for i.MX8MN clock driver")
Signed-off-by: Hao Luo <m202171776@hust.edu.cn>
Reviewed-by: Dongliang Mu <dzm91@hust.edu.cn>
Reviewed-by: Peng Fan <peng.fan@nxp.com>
Link: https://lore.kernel.org/r/20230411015107.2645-1-m202171776@hust.edu.cn
Signed-off-by: Abel Vesa <abel.vesa@linaro.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/clk/imx/clk-imx8mn.c