mirror of
https://github.com/torvalds/linux.git
synced 2026-11-08 21:24:02 +01:00
clk: versatile: clk-icst: Fix node reference leak in of_syscon_icst_setup()
of_get_parent() takes a reference on the syscon parent node. The
reference is intentionally kept on the success path, but the error paths
return without dropping it, leaking the node reference. Release the
reference before returning on the error paths.
Fixes: d430819d69 ("clk: versatile-icst: add device tree support")
Signed-off-by: Wentao Liang <vulab@iscas.ac.cn>
Reviewed-by: Linus Walleij <linusw@kernel.org>
Signed-off-by: Brian Masney <bmasney@redhat.com>
This commit is contained in:
parent
d27364c5db
commit
c90a50d07f
|
|
@ -516,16 +516,19 @@ static void __init of_syscon_icst_setup(struct device_node *np)
|
|||
map = syscon_node_to_regmap(parent);
|
||||
if (IS_ERR(map)) {
|
||||
pr_err("no regmap for syscon ICST clock parent\n");
|
||||
of_node_put(parent);
|
||||
return;
|
||||
}
|
||||
|
||||
if (of_property_read_u32(np, "reg", &icst_desc.vco_offset) &&
|
||||
of_property_read_u32(np, "vco-offset", &icst_desc.vco_offset)) {
|
||||
pr_err("no VCO register offset for ICST clock\n");
|
||||
of_node_put(parent);
|
||||
return;
|
||||
}
|
||||
if (of_property_read_u32(np, "lock-offset", &icst_desc.lock_offset)) {
|
||||
pr_err("no lock register offset for ICST clock\n");
|
||||
of_node_put(parent);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -552,6 +555,7 @@ static void __init of_syscon_icst_setup(struct device_node *np)
|
|||
ctype = ICST_INTEGRATOR_CP_CM_MEM;
|
||||
} else {
|
||||
pr_err("unknown ICST clock %pOF\n", np);
|
||||
of_node_put(parent);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user