This is a note to let you know that I've just added the patch titled clk: mediatek: fix of_iomap memory leak to the 6.1-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the patch is: clk-mediatek-fix-of_iomap-memory-leak.patch and it can be found in the queue-6.1 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let <stable@xxxxxxxxxxxxxxx> know about it. commit 20dc2f887e6793acb93a1af56ab3c7038d56b852 Author: Bosi Zhang <u201911157@xxxxxxxxxxx> Date: Sat Apr 22 08:43:31 2023 +0000 clk: mediatek: fix of_iomap memory leak [ Upstream commit 3db7285e044144fd88a356f5b641b9cd4b231a77 ] Smatch reports: drivers/clk/mediatek/clk-mtk.c:583 mtk_clk_simple_probe() warn: 'base' from of_iomap() not released on lines: 496. This problem was also found in linux-next. In mtk_clk_simple_probe(), base is not released when handling errors if clk_data is not existed, which may cause a leak. So free_base should be added here to release base. Fixes: c58cd0e40ffa ("clk: mediatek: Add mtk_clk_simple_probe() to simplify clock providers") Signed-off-by: Bosi Zhang <u201911157@xxxxxxxxxxx> Reviewed-by: Dongliang Mu <dzm91@xxxxxxxxxxx> Link: https://lore.kernel.org/r/20230422084331.47198-1-u201911157@xxxxxxxxxxx Signed-off-by: Stephen Boyd <sboyd@xxxxxxxxxx> Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx> diff --git a/drivers/clk/mediatek/clk-mtk.c b/drivers/clk/mediatek/clk-mtk.c index bfabd94a474a5..bb89963e5e1fa 100644 --- a/drivers/clk/mediatek/clk-mtk.c +++ b/drivers/clk/mediatek/clk-mtk.c @@ -476,8 +476,10 @@ int mtk_clk_simple_probe(struct platform_device *pdev) num_clks += mcd->num_mux_clks; clk_data = mtk_alloc_clk_data(num_clks); - if (!clk_data) - return -ENOMEM; + if (!clk_data) { + r = -ENOMEM; + goto free_base; + } if (mcd->fixed_clks) { r = mtk_clk_register_fixed_clks(mcd->fixed_clks, @@ -554,6 +556,7 @@ int mtk_clk_simple_probe(struct platform_device *pdev) mcd->num_fixed_clks, clk_data); free_data: mtk_free_clk_data(clk_data); +free_base: if (mcd->shared_io && base) iounmap(base); return r;