Commit 1ad7e25e authored by Nicholas Mc Guire's avatar Nicholas Mc Guire Committed by Kleber Sacilotto de Souza

ARM: hisi: fix error handling and missing of_node_put

BugLink: https://bugs.launchpad.net/bugs/1798587

[ Upstream commit 9f30b5ae ]

of_iomap() can return NULL which seems critical here and thus should be
explicitly flagged so that the cause of system halting can be understood.
As of_find_compatible_node() is returning a device node with refcount
incremented it must be explicitly decremented here.
Signed-off-by: default avatarNicholas Mc Guire <hofrat@osadl.org>
Fixes: commit 7fda91e7 ("ARM: hisi: enable smp for HiP01")
Signed-off-by: default avatarWei Xu <xuwei5@hisilicon.com>
Signed-off-by: default avatarSasha Levin <alexander.levin@microsoft.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: default avatarStefan Bader <stefan.bader@canonical.com>
Signed-off-by: default avatarKleber Sacilotto de Souza <kleber.souza@canonical.com>
parent 72306dee
...@@ -226,10 +226,10 @@ void hip01_set_cpu(int cpu, bool enable) ...@@ -226,10 +226,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