mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-12 21:57:43 +00:00
clk: st: Hold reference returned by of_get_parent()
[ Upstream commit429973306f
] We should hold the reference returned by of_get_parent() and use it to call of_node_put() for refcount balance. Fixes:3efe64ef51
("clk: st: clkgen-fsyn: search reg within node or parent") Fixes:810251b0d3
("clk: st: clkgen-mux: search reg within node or parent") Signed-off-by: Liang He <windhl@126.com> Link: https://lore.kernel.org/r/20220628142416.169808-1-windhl@126.com Signed-off-by: Stephen Boyd <sboyd@kernel.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
parent
7cee78b8ae
commit
72f2956d47
2 changed files with 8 additions and 2 deletions
|
@ -987,6 +987,7 @@ static void __init st_of_quadfs_setup(struct device_node *np,
|
||||||
const char *pll_name, *clk_parent_name;
|
const char *pll_name, *clk_parent_name;
|
||||||
void __iomem *reg;
|
void __iomem *reg;
|
||||||
spinlock_t *lock;
|
spinlock_t *lock;
|
||||||
|
struct device_node *parent_np;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* First check for reg property within the node to keep backward
|
* First check for reg property within the node to keep backward
|
||||||
|
@ -994,7 +995,9 @@ static void __init st_of_quadfs_setup(struct device_node *np,
|
||||||
*/
|
*/
|
||||||
reg = of_iomap(np, 0);
|
reg = of_iomap(np, 0);
|
||||||
if (!reg) {
|
if (!reg) {
|
||||||
reg = of_iomap(of_get_parent(np), 0);
|
parent_np = of_get_parent(np);
|
||||||
|
reg = of_iomap(parent_np, 0);
|
||||||
|
of_node_put(parent_np);
|
||||||
if (!reg) {
|
if (!reg) {
|
||||||
pr_err("%s: Failed to get base address\n", __func__);
|
pr_err("%s: Failed to get base address\n", __func__);
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -56,6 +56,7 @@ static void __init st_of_clkgen_mux_setup(struct device_node *np,
|
||||||
void __iomem *reg;
|
void __iomem *reg;
|
||||||
const char **parents;
|
const char **parents;
|
||||||
int num_parents = 0;
|
int num_parents = 0;
|
||||||
|
struct device_node *parent_np;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* First check for reg property within the node to keep backward
|
* First check for reg property within the node to keep backward
|
||||||
|
@ -63,7 +64,9 @@ static void __init st_of_clkgen_mux_setup(struct device_node *np,
|
||||||
*/
|
*/
|
||||||
reg = of_iomap(np, 0);
|
reg = of_iomap(np, 0);
|
||||||
if (!reg) {
|
if (!reg) {
|
||||||
reg = of_iomap(of_get_parent(np), 0);
|
parent_np = of_get_parent(np);
|
||||||
|
reg = of_iomap(parent_np, 0);
|
||||||
|
of_node_put(parent_np);
|
||||||
if (!reg) {
|
if (!reg) {
|
||||||
pr_err("%s: Failed to get base address\n", __func__);
|
pr_err("%s: Failed to get base address\n", __func__);
|
||||||
return;
|
return;
|
||||||
|
|
Loading…
Reference in a new issue