Skip to content

Commit 4b84d49

Browse files
outman119Abel Vesa
authored andcommitted
clk: imx: imx6q: Fix device node reference leak in pll6_bypassed()
The function pll6_bypassed() calls of_parse_phandle_with_args() but never calls of_node_put() to release the reference, causing a memory leak. Fix this by adding proper cleanup calls on all exit paths. Fixes: 3cc4897 ("clk: imx6q: handle ENET PLL bypass") Signed-off-by: Felix Gu <ustc.gu@gmail.com> Reviewed-by: Frank Li <Frank.Li@nxp.com> Reviewed-by: Peng Fan <peng.fan@nxp.com> Link: https://patch.msgid.link/20260203-clk-imx6q-v3-1-6cd2696bb371@gmail.com Signed-off-by: Abel Vesa <abel.vesa@oss.qualcomm.com>
1 parent a15840f commit 4b84d49

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

drivers/clk/imx/clk-imx6q.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -238,8 +238,11 @@ static bool pll6_bypassed(struct device_node *node)
238238
return false;
239239

240240
if (clkspec.np == node &&
241-
clkspec.args[0] == IMX6QDL_PLL6_BYPASS)
241+
clkspec.args[0] == IMX6QDL_PLL6_BYPASS) {
242+
of_node_put(clkspec.np);
242243
break;
244+
}
245+
of_node_put(clkspec.np);
243246
}
244247

245248
/* PLL6 bypass is not part of the assigned clock list */
@@ -249,6 +252,9 @@ static bool pll6_bypassed(struct device_node *node)
249252
ret = of_parse_phandle_with_args(node, "assigned-clock-parents",
250253
"#clock-cells", index, &clkspec);
251254

255+
if (!ret)
256+
of_node_put(clkspec.np);
257+
252258
if (clkspec.args[0] != IMX6QDL_CLK_PLL6)
253259
return true;
254260

0 commit comments

Comments
 (0)