Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 03ace9d6 authored by Nicholas Mc Guire's avatar Nicholas Mc Guire Committed by Greg Kroah-Hartman
Browse files

ARM: hisi: check of_iomap and fix missing of_node_put



[ Upstream commit 81646a3d39ef14749301374a3a0b8311384cd412 ]

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: default avatarNicholas Mc Guire <hofrat@osadl.org>
0002 Fixes: commit 06cc5c1d ("ARM: hisi: enable hix5hd2 SoC")
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>
parent 073b26b9
Loading
Loading
Loading
Loading
+9 −5
Original line number Diff line number Diff line
@@ -177,11 +177,15 @@ static bool hix5hd2_hotplug_init(void)
	struct device_node *np;

	np = of_find_compatible_node(NULL, NULL, "hisilicon,cpuctrl");
	if (np) {
	if (!np)
		return false;

	ctrl_base = of_iomap(np, 0);
		return true;
	}
	of_node_put(np);
	if (!ctrl_base)
		return false;

	return true;
}

void hix5hd2_set_cpu(int cpu, bool enable)