mirror of
https://github.com/torvalds/linux.git
synced 2026-09-23 22:14:03 +02:00
clk: tegra: tegra124-emc: put EMC node on register failure
tegra124_clk_register_emc() stores a device node reference returned by
of_parse_phandle() in tegra->emc_node.
If clk_register() fails, the function returns an error before that
reference can be consumed and released by the normal runtime path. The
tegra_clk_emc object is freed on this failure path, but freeing the
object does not drop the OF node reference stored in it.
Drop the EMC node reference before freeing the tegra_clk_emc object.
of_node_put() is safe for a NULL node, so this also covers the case where
the phandle is absent.
Fixes: 2db04f16b5 ("clk: tegra: Add EMC clock driver")
Signed-off-by: Guangshuo Li <lgs201920130244@gmail.com>
Reviewed-by: Brian Masney <bmasney@redhat.com>
Signed-off-by: Brian Masney <bmasney@redhat.com>
This commit is contained in:
parent
584dfca970
commit
f726279f5e
|
|
@ -537,6 +537,7 @@ struct clk *tegra124_clk_register_emc(void __iomem *base, struct device_node *np
|
|||
|
||||
clk = clk_register(NULL, &tegra->hw);
|
||||
if (IS_ERR(clk)) {
|
||||
of_node_put(tegra->emc_node);
|
||||
kfree(tegra);
|
||||
return clk;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user