]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commitdiff
ARM: hisi: fix error handling and missing of_node_put
authorNicholas Mc Guire <hofrat@osadl.org>
Thu, 12 Jul 2018 09:28:22 +0000 (11:28 +0200)
committerJuerg Haefliger <juergh@canonical.com>
Wed, 24 Jul 2019 01:49:13 +0000 (19:49 -0600)
BugLink: https://bugs.launchpad.net/bugs/1836117
[ Upstream commit 9f30b5ae0585ca5234fe979294b8f897299dec99 ]

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: Nicholas Mc Guire <hofrat@osadl.org>
Fixes: commit 7fda91e73155 ("ARM: hisi: enable smp for HiP01")
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>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Kleber Sacilotto de Souza <kleber.souza@canonical.com>
arch/arm/mach-hisi/hotplug.c

index 3f28c9141b4881110c7fbbaf242f71dae488cf17..32870560b2806a08e6e555b38233e417378bd604 100644 (file)
@@ -226,10 +226,10 @@ void hip01_set_cpu(int cpu, bool enable)
 
        if (!ctrl_base) {
                np = of_find_compatible_node(NULL, NULL, "hisilicon,hip01-sysctrl");
-               if (np)
-                       ctrl_base = of_iomap(np, 0);
-               else
-                       BUG();
+               BUG_ON(!np);
+               ctrl_base = of_iomap(np, 0);
+               of_node_put(np);
+               BUG_ON(!ctrl_base);
        }
 
        if (enable) {