OSDN Git Service

powerpc/prom_init: Fix improper check of prom_getprop()
authorPeiwei Hu <jlu.hpw@foxmail.com>
Fri, 19 Nov 2021 09:12:18 +0000 (17:12 +0800)
committerMichael Ellerman <mpe@ellerman.id.au>
Thu, 25 Nov 2021 00:25:33 +0000 (11:25 +1100)
prom_getprop() can return PROM_ERROR. Binary operator can not identify
it.

Fixes: 94d2dde738a5 ("[POWERPC] Efika: prune fixups and make them more carefull")
Signed-off-by: Peiwei Hu <jlu.hpw@foxmail.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/tencent_BA28CC6897B7C95A92EB8C580B5D18589105@qq.com
arch/powerpc/kernel/prom_init.c

index 18b04b0..f845065 100644 (file)
@@ -2991,7 +2991,7 @@ static void __init fixup_device_tree_efika_add_phy(void)
 
        /* Check if the phy-handle property exists - bail if it does */
        rv = prom_getprop(node, "phy-handle", prop, sizeof(prop));
-       if (!rv)
+       if (rv <= 0)
                return;
 
        /*