From: Haotian Zhang <vulab@iscas.ac.cn>
To: mturquette@baylibre.com, sboyd@kernel.org,
matthias.bgg@gmail.com, angelogioacchino.delregno@collabora.com
Cc: linux-clk@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-arm-kernel@lists.infradead.org,
linux-mediatek@lists.infradead.org,
Haotian Zhang <vulab@iscas.ac.cn>
Subject: [PATCH] clk: mediatek: mt8173-apmixed: Fix ioremap resource leak in remove function
Date: Tue, 4 Nov 2025 12:04:31 +0800 [thread overview]
Message-ID: <20251104040431.1452-1-vulab@iscas.ac.cn> (raw)
The driver uses of_iomap() to map I/O memory in probe function, but
forgets to call iounmap() in the remove function, leading to a resource
leak when the driver is unloaded.
Replace of_iomap() with devm_of_iomap() to automatically manage the
I/O memory mapping. Remove the now-unnecessary unmap_io label and
iounmap() call from the error path.
Fixes: 4c02c9af3cb9 ("clk: mediatek: mt8173: Break down clock drivers and allow module build")
Signed-off-by: Haotian Zhang <vulab@iscas.ac.cn>
---
drivers/clk/mediatek/clk-mt8173-apmixedsys.c | 14 +++++---------
1 file changed, 5 insertions(+), 9 deletions(-)
diff --git a/drivers/clk/mediatek/clk-mt8173-apmixedsys.c b/drivers/clk/mediatek/clk-mt8173-apmixedsys.c
index 95385bb67d55..ae759ef51f03 100644
--- a/drivers/clk/mediatek/clk-mt8173-apmixedsys.c
+++ b/drivers/clk/mediatek/clk-mt8173-apmixedsys.c
@@ -146,15 +146,13 @@ static int clk_mt8173_apmixed_probe(struct platform_device *pdev)
struct clk_hw *hw;
int r;
- base = of_iomap(node, 0);
- if (!base)
- return -ENOMEM;
+ base = devm_of_iomap(&pdev->dev, node, 0, NULL);
+ if (IS_ERR(base))
+ return PTR_ERR(base);
clk_data = mtk_alloc_clk_data(CLK_APMIXED_NR_CLK);
- if (IS_ERR_OR_NULL(clk_data)) {
- r = -ENOMEM;
- goto unmap_io;
- }
+ if (IS_ERR_OR_NULL(clk_data))
+ return -ENOMEM;
fhctl_parse_dt(fhctl_node, pllfhs, ARRAY_SIZE(pllfhs));
r = mtk_clk_register_pllfhs(node, plls, ARRAY_SIZE(plls),
@@ -188,8 +186,6 @@ static int clk_mt8173_apmixed_probe(struct platform_device *pdev)
ARRAY_SIZE(pllfhs), clk_data);
free_clk_data:
mtk_free_clk_data(clk_data);
-unmap_io:
- iounmap(base);
return r;
}
--
2.50.1.windows.1
reply other threads:[~2025-11-04 4:05 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20251104040431.1452-1-vulab@iscas.ac.cn \
--to=vulab@iscas.ac.cn \
--cc=angelogioacchino.delregno@collabora.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-clk@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mediatek@lists.infradead.org \
--cc=matthias.bgg@gmail.com \
--cc=mturquette@baylibre.com \
--cc=sboyd@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).