Commit 484a033b authored by Olof Johansson's avatar Olof Johansson

Merge tag 'hisi-armv7-soc-for-4.19' of git://github.com/hisilicon/linux-hisi into next/soc

ARM: mach-hisi: Hisilicon SoC updates for 4.19

- check of_iomap and add missing of_node_put since of_find_compatible_node
  is invoked on hisilicon SoCs like hip01, hix5hd2 and hi3xxx.

* tag 'hisi-armv7-soc-for-4.19' of git://github.com/hisilicon/linux-hisi:
  ARM: hisi: handle of_iomap and fix missing of_node_put
  ARM: hisi: check of_iomap and fix missing of_node_put
  ARM: hisi: fix error handling and missing of_node_put
Signed-off-by: default avatarOlof Johansson <olof@lixom.net>
parents 07167d8a d396cb18
...@@ -148,13 +148,20 @@ static int hi3xxx_hotplug_init(void) ...@@ -148,13 +148,20 @@ static int hi3xxx_hotplug_init(void)
struct device_node *node; struct device_node *node;
node = of_find_compatible_node(NULL, NULL, "hisilicon,sysctrl"); node = of_find_compatible_node(NULL, NULL, "hisilicon,sysctrl");
if (node) { if (!node) {
ctrl_base = of_iomap(node, 0); id = ERROR_CTRL;
id = HI3620_CTRL; return -ENOENT;
return 0;
} }
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) void hi3xxx_set_cpu(int cpu, bool enable)
...@@ -173,11 +180,15 @@ static bool hix5hd2_hotplug_init(void) ...@@ -173,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 false;
return true;
} ctrl_base = of_iomap(np, 0);
return false; 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)
...@@ -219,10 +230,10 @@ void hip01_set_cpu(int cpu, bool enable) ...@@ -219,10 +230,10 @@ void hip01_set_cpu(int cpu, bool enable)
if (!ctrl_base) { if (!ctrl_base) {
np = of_find_compatible_node(NULL, NULL, "hisilicon,hip01-sysctrl"); np = of_find_compatible_node(NULL, NULL, "hisilicon,hip01-sysctrl");
if (np) BUG_ON(!np);
ctrl_base = of_iomap(np, 0); ctrl_base = of_iomap(np, 0);
else of_node_put(np);
BUG(); BUG_ON(!ctrl_base);
} }
if (enable) { if (enable) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment