mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-11 21:38:32 +08:00
ARM: hisi: handle of_iomap and fix missing of_node_put
Relying on an unchecked of_iomap() which can return NULL is problematic
here, an explicit check seems mandatory. Also the call to
of_find_compatible_node() returns a device node with refcount incremented
therefor an explicit of_node_put() is needed here.
Signed-off-by: Nicholas Mc Guire <hofrat@osadl.org>
Fixes: commit 22bae42904
("ARM: hi3xxx: add hotplug support")
Signed-off-by: Wei Xu <xuwei5@hisilicon.com>
This commit is contained in:
parent
81646a3d39
commit
d396cb185c
@ -148,15 +148,22 @@ static int hi3xxx_hotplug_init(void)
|
||||
struct device_node *node;
|
||||
|
||||
node = of_find_compatible_node(NULL, NULL, "hisilicon,sysctrl");
|
||||
if (node) {
|
||||
ctrl_base = of_iomap(node, 0);
|
||||
id = HI3620_CTRL;
|
||||
return 0;
|
||||
}
|
||||
if (!node) {
|
||||
id = ERROR_CTRL;
|
||||
return -ENOENT;
|
||||
}
|
||||
|
||||
ctrl_base = of_iomap(node, 0);
|
||||
of_node_put(node);
|
||||
if (!ctrl_base) {
|
||||
id = ERROR_CTRL;
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
id = HI3620_CTRL;
|
||||
return 0;
|
||||
}
|
||||
|
||||
void hi3xxx_set_cpu(int cpu, bool enable)
|
||||
{
|
||||
if (!ctrl_base) {
|
||||
|
Loading…
Reference in New Issue
Block a user