[PATCH] clk: mediatek: clk-mt8173: fix memory leak in clk_mt8173_apmixed_probe

From: Ziqin Liu
Date: Tue Apr 25 2023 - 09:28:38 EST


'base' from of_iomap() is not released until the prode function returns,
a memory leak will occur in some case, so use devm_of_iomap() instead of
of_iomap() to automatically handle the unused ioremap region.

Fixes: 4c02c9af3cb9 ("clk: mediatek: mt8173: Break down clock drivers and allow module build")
Signed-off-by: Ziqin Liu <ziqin_l@xxxxxxxxxxx>
---
drivers/clk/mediatek/clk-mt8173-apmixedsys.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/clk/mediatek/clk-mt8173-apmixedsys.c b/drivers/clk/mediatek/clk-mt8173-apmixedsys.c
index a56c5845d07a..f80de9e60b21 100644
--- a/drivers/clk/mediatek/clk-mt8173-apmixedsys.c
+++ b/drivers/clk/mediatek/clk-mt8173-apmixedsys.c
@@ -90,7 +90,7 @@ static int clk_mt8173_apmixed_probe(struct platform_device *pdev)
struct clk_hw *hw;
int r;

- base = of_iomap(node, 0);
+ base = devm_of_iomap(pdev->dev, node, 0, NULL);
if (!base)
return PTR_ERR(base);

--
2.25.1