[PATCH v6 17/27] clk: mediatek: pllfh: clear state data in mtk_clk_cleanup_pllfhs

From: Louis-Alexis Eyraud

Date: Fri Sep 04 2026 - 13:51:01 EST


Currently, fhctl_parse_dt function sets some state variables that are
never cleared in the unregister nominal path or register error one.
As they are stored in a static array variable, given as parameter from
the caller function, they retain their values until they are initialized
again by another fhctl_parse_dt call.

So, add a loop to clear these state variables in mtk_clk_cleanup_pllfhs
function.

Signed-off-by: Louis-Alexis Eyraud <louisalexis.eyraud@xxxxxxxxxxxxx>
---
drivers/clk/mediatek/clk-pllfh.c | 8 ++++++++
1 file changed, 8 insertions(+)

diff --git a/drivers/clk/mediatek/clk-pllfh.c b/drivers/clk/mediatek/clk-pllfh.c
index 398edad2a69e..ae56d4ad66dc 100644
--- a/drivers/clk/mediatek/clk-pllfh.c
+++ b/drivers/clk/mediatek/clk-pllfh.c
@@ -244,6 +244,14 @@ static void mtk_clk_cleanup_pllfhs(void __iomem *iomem_base,
clk_data->hws[pll->id] = ERR_PTR(-ENOENT);
}

+ for (i = 0; i < num_fhs; i++) {
+ struct mtk_pllfh_data *pllfh = &pllfhs[i];
+
+ pllfh->state.fh_enable = 0;
+ pllfh->state.ssc_rate = 0;
+ pllfh->state.base = NULL;
+ }
+
if (fhctl_base)
iounmap(fhctl_base);


--
2.55.0