[PATCH] clk: eyeq: release OLB mapping in eqc_early_init() error and success paths

From: Haotian Zhang

Date: Thu Oct 08 2026 - 23:28:22 EST


eqc_early_init() calls of_iomap() to read the early PLL registers, then
returns to the caller without ever calling iounmap(). The mapping is not
stored in any structure, is not devm-managed and is not carried over to
the platform device, so it is leaked on both the success path and every
goto err path (early clock probe failure and of_clk_add_hw_provider()
failure). The early clocks registered here are all fixed factors, so they
do not keep the mapping alive.

Release the mapping with iounmap() before returning on success and in the
error path, initializing base to NULL so that the allocation failure path
taken before of_iomap() does not unmap an uninitialized pointer.

Fixes: 25d904946a0b ("clk: eyeq: add driver")
Assisted-by: DeepSeek-V4.1-Flash
Signed-off-by: Haotian Zhang <vulab@xxxxxxxxxxx>
---
drivers/clk/clk-eyeq.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/drivers/clk/clk-eyeq.c b/drivers/clk/clk-eyeq.c
index cf37feccc734..257e1094aa27 100644
--- a/drivers/clk/clk-eyeq.c
+++ b/drivers/clk/clk-eyeq.c
@@ -1240,7 +1240,7 @@ static void __init eqc_early_init(struct device_node *np,
{
struct clk_hw_onecell_data *cells;
unsigned int i, clk_count;
- void __iomem *base;
+ void __iomem *base = NULL;
int ret;

clk_count = early_data->early_clk_count + early_data->late_clk_count;
@@ -1288,6 +1288,9 @@ static void __init eqc_early_init(struct device_node *np,
goto err;
}

+ /* base was only needed to read the early PLL registers. */
+ iounmap(base);
+
return;

err:
@@ -1313,6 +1316,9 @@ static void __init eqc_early_init(struct device_node *np,

kfree(cells);
}
+
+ if (base)
+ iounmap(base);
}

static void __init eqc_eyeq5_early_init(struct device_node *np)
--
2.25.1