]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
clk: mediatek: clk-mt8173-apmixedsys: Fix iomap not released issue
authorAngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Thu, 15 Jun 2023 12:20:51 +0000 (14:20 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 11 Jul 2023 17:39:43 +0000 (19:39 +0200)
[ Upstream commit b270ae61730e0ebccee39a21dd3311d6896a38ae ]

In case of error after of_ioremap() the resource must be released:
call iounmap() where appropriate to fix that.

Fixes: 41138fbf876c ("clk: mediatek: mt8173: Migrate to platform driver and common probe")
Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Link: https://lore.kernel.org/r/20230615122051.546985-4-angelogioacchino.delregno@collabora.com
Reviewed-by: Chen-Yu Tsai <wenst@chromium.org>
Signed-off-by: Stephen Boyd <sboyd@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/clk/mediatek/clk-mt8173-apmixedsys.c

index a335d076d3f2804de4da6a0dd0dd0ae071fa29f8..0b95d14c1804267c6ac72a316b5f8f2a9f5c8a3d 100644 (file)
@@ -95,8 +95,10 @@ static int clk_mt8173_apmixed_probe(struct platform_device *pdev)
                return -ENOMEM;
 
        clk_data = mtk_alloc_clk_data(CLK_APMIXED_NR_CLK);
-       if (IS_ERR_OR_NULL(clk_data))
+       if (IS_ERR_OR_NULL(clk_data)) {
+               iounmap(base);
                return -ENOMEM;
+       }
 
        r = mtk_clk_register_plls(node, plls, ARRAY_SIZE(plls), clk_data);
        if (r)
@@ -127,6 +129,7 @@ unregister_plls:
        mtk_clk_unregister_plls(plls, ARRAY_SIZE(plls), clk_data);
 free_clk_data:
        mtk_free_clk_data(clk_data);
+       iounmap(base);
        return r;
 }