Skip to content

Commit f1d97a3

Browse files
Yang Yingliangbebarino
authored andcommitted
clk: mediatek: clk-pllfh: fix missing of_node_put() in fhctl_parse_dt()
The device_node pointer returned by of_find_compatible_node() with refcount incremented, when finish using it, the refcount need be decreased. Fixes: d7964de ("clk: mediatek: Add new clock driver to handle FHCTL hardware") Signed-off-by: Yang Yingliang <yangyingliang@huawei.com> Link: https://lore.kernel.org/r/20221229092946.4162345-1-yangyingliang@huawei.com [sboyd@kernel.org: Also unmap on error] Signed-off-by: Stephen Boyd <sboyd@kernel.org>
1 parent d02fddf commit f1d97a3

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

drivers/clk/mediatek/clk-pllfh.c

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,13 +75,13 @@ void fhctl_parse_dt(const u8 *compatible_node, struct mtk_pllfh_data *pllfhs,
7575
base = of_iomap(node, 0);
7676
if (!base) {
7777
pr_err("%s(): ioremap failed\n", __func__);
78-
return;
78+
goto out_node_put;
7979
}
8080

8181
num_clocks = of_clk_get_parent_count(node);
8282
if (!num_clocks) {
8383
pr_err("%s(): failed to get clocks property\n", __func__);
84-
return;
84+
goto err;
8585
}
8686

8787
for (i = 0; i < num_clocks; i++) {
@@ -102,6 +102,13 @@ void fhctl_parse_dt(const u8 *compatible_node, struct mtk_pllfh_data *pllfhs,
102102
pllfh->state.ssc_rate = ssc_rate;
103103
pllfh->state.base = base;
104104
}
105+
106+
out_node_put:
107+
of_node_put(node);
108+
return;
109+
err:
110+
iounmap(base);
111+
goto out_node_put;
105112
}
106113

107114
static void pllfh_init(struct mtk_fh *fh, struct mtk_pllfh_data *pllfh_data)

0 commit comments

Comments
 (0)