]> git.baikalelectronics.ru Git - kernel.git/commit
of: fix phandle cache creation for DTs with no phandles
authorRob Herring <robh@kernel.org>
Tue, 11 Sep 2018 14:28:14 +0000 (09:28 -0500)
committerRob Herring <robh@kernel.org>
Tue, 11 Sep 2018 16:28:40 +0000 (11:28 -0500)
commitb6a696bb325e28eb4b3205f58fe195f56eed4507
treef31ac5662c779ae66b72c91dcaf3be22087daeca
parentda99777d194830e8b026a4b965578298ac4cd613
of: fix phandle cache creation for DTs with no phandles

With commit 2025451f9289 ("of: cache phandle nodes to reduce cost of
of_find_node_by_phandle()"), a G3 PowerMac fails to boot. The root cause
is the DT for this system has no phandle properties when booted with
BootX. of_populate_phandle_cache() does not handle the case of no
phandles correctly. The problem is roundup_pow_of_two() for 0 is
undefined. The implementation subtracts 1 underflowing and then things
are in the weeds.

Fixes: 2025451f9289 ("of: cache phandle nodes to reduce cost of of_find_node_by_phandle()")
Cc: stable@vger.kernel.org # 4.17+
Reported-by: Finn Thain <fthain@telegraphics.com.au>
Tested-by: Stan Johnson <userm57@yahoo.com>
Reviewed-by: Frank Rowand <frank.rowand@sony.com>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Rob Herring <robh@kernel.org>
drivers/of/base.c