# \[PATCH\] powerpc/prom\_init: fix the improper check of prom\_getprop

- Subsystems: LINUX FOR POWERPC (32-BIT AND 64-BIT), THE REST
- Maintainers: Madhavan Srinivasan, Linus Torvalds
- Status: LANDED (869fb7e5aecb · 2021-11-25 00:25)
- Landed in mainline as 869fb7e5aecb on 2021-11-25.
- List: linuxppc-dev
- 3 messages, 3 authors
- Page: https://ratatoskr.run/linuxppc-dev/2021/11/1579786/t

## \[PATCH\] powerpc/prom\_init: fix the improper check of prom\_getprop

- From: Peiwei Hu \<hidden\>
- Date: 2021-11-19 09:45:49 
- Message: https://ratatoskr.run/linuxppc-dev/2021/11/1579786.md

```text
prom_getprop() can return PROM_ERROR. Binary operator can not identify it.

Signed-off-by: Peiwei Hu <redacted>
---
 arch/powerpc/kernel/prom_init.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/powerpc/kernel/prom_init.c b/arch/powerpc/kernel/prom_init.c
index 18b04b08b983..f845065c860e 100644
--- a/arch/powerpc/kernel/prom_init.c
+++ b/arch/powerpc/kernel/prom_init.c
@@ -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;
 
 	/*
-- 
2.25.1

```

## Re: \[PATCH\] powerpc/prom\_init: fix the improper check of prom\_getprop

- From: Andy Shevchenko \<andriy.shevchenko@linux.intel.com\>
- Date: 2021-11-19 09:46:48 
- Message: https://ratatoskr.run/linuxppc-dev/2021/11/1579787.md

```text
On Fri, Nov 19, 2021 at 05:12:18PM +0800, Peiwei Hu wrote:
> prom_getprop() can return PROM_ERROR. Binary operator can not identify it.

Fixes: 94d2dde738a5 ("[POWERPC] Efika: prune fixups and make them more carefull")

?

P.S. Try to use my script [1] to send patches, it should be smart enough to not
include my name, for example.

[1]: https://github.com/andy-shev/home-bin-tools/blob/master/ge2maintainer.sh

-- 
With Best Regards,
Andy Shevchenko


```

## Re: \[PATCH\] powerpc/prom\_init: fix the improper check of prom\_getprop

- From: Michael Ellerman \<hidden\>
- Date: 2021-11-25 09:49:36 
- Message: https://ratatoskr.run/linuxppc-dev/2021/11/1586319.md

```text
On Fri, 19 Nov 2021 17:12:18 +0800, Peiwei Hu wrote:
> prom_getprop() can return PROM_ERROR. Binary operator can not identify it.
> 
> 

Applied to powerpc/next.

[1/1] powerpc/prom_init: fix the improper check of prom_getprop
      https://git.kernel.org/powerpc/c/869fb7e5aecbc163003f93f36dcc26d0554319f6

cheers
```
