Skip to content

Commit 9faf207

Browse files
outman119Abel Vesa
authored andcommitted
clk: imx: imx6q: Fix device node reference leak in of_assigned_ldb_sels()
The function of_assigned_ldb_sels() 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: 5d283b0 ("clk: imx6: Fix procedure to switch the parent of LDB_DI_CLK") 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-2-6cd2696bb371@gmail.com Signed-off-by: Abel Vesa <abel.vesa@oss.qualcomm.com>
1 parent 4b84d49 commit 9faf207

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

drivers/clk/imx/clk-imx6q.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,19 +188,23 @@ static void of_assigned_ldb_sels(struct device_node *node,
188188
}
189189
if (clkspec.np != node || clkspec.args[0] >= IMX6QDL_CLK_END) {
190190
pr_err("ccm: parent clock %d not in ccm\n", index);
191+
of_node_put(clkspec.np);
191192
return;
192193
}
193194
parent = clkspec.args[0];
195+
of_node_put(clkspec.np);
194196

195197
rc = of_parse_phandle_with_args(node, "assigned-clocks",
196198
"#clock-cells", index, &clkspec);
197199
if (rc < 0)
198200
return;
199201
if (clkspec.np != node || clkspec.args[0] >= IMX6QDL_CLK_END) {
200202
pr_err("ccm: child clock %d not in ccm\n", index);
203+
of_node_put(clkspec.np);
201204
return;
202205
}
203206
child = clkspec.args[0];
207+
of_node_put(clkspec.np);
204208

205209
if (child != IMX6QDL_CLK_LDB_DI0_SEL &&
206210
child != IMX6QDL_CLK_LDB_DI1_SEL)

0 commit comments

Comments
 (0)