mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-06 19:07:52 +00:00
ARM: hisi: check of_iomap and fix missing of_node_put
[ Upstream commit81646a3d39
] of_find_compatible_node() returns a device node with refcount incremented and thus needs an explicit of_node_put(). Further relying on an unchecked of_iomap() which can return NULL is problematic here, after all ctrl_base is critical enough for hix5hd2_set_cpu() to call BUG() if not available so a check seems mandated here. Signed-off-by: Nicholas Mc Guire <hofrat@osadl.org> 0002 Fixes: commit06cc5c1d4d
("ARM: hisi: enable hix5hd2 SoC") Signed-off-by: Wei Xu <xuwei5@hisilicon.com> Signed-off-by: Sasha Levin <alexander.levin@microsoft.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
e1912dc20c
commit
6c4abbeb25
1 changed files with 9 additions and 5 deletions
|
@ -180,11 +180,15 @@ static bool hix5hd2_hotplug_init(void)
|
||||||
struct device_node *np;
|
struct device_node *np;
|
||||||
|
|
||||||
np = of_find_compatible_node(NULL, NULL, "hisilicon,cpuctrl");
|
np = of_find_compatible_node(NULL, NULL, "hisilicon,cpuctrl");
|
||||||
if (np) {
|
if (!np)
|
||||||
ctrl_base = of_iomap(np, 0);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
ctrl_base = of_iomap(np, 0);
|
||||||
|
of_node_put(np);
|
||||||
|
if (!ctrl_base)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void hix5hd2_set_cpu(int cpu, bool enable)
|
void hix5hd2_set_cpu(int cpu, bool enable)
|
||||||
|
|
Loading…
Reference in a new issue