All of lore.kernel.org
 help / color / mirror / Atom feed
From: Peiwei Hu <jlu.hpw@foxmail.com>
To: mpe@ellerman.id.au, benh@kernel.crashing.org, paulus@samba.org,
	aneesh.kumar@linux.ibm.com, ardb@kernel.org,
	rafael.j.wysocki@intel.com, masahiroy@kernel.org,
	npiggin@gmail.com, andriy.shevchenko@linux.intel.com,
	adobriyan@gmail.com, clg@kaod.org
Cc: linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org,
	trivial@kernel.org, Peiwei Hu <jlu.hpw@foxmail.com>
Subject: [PATCH] powerpc/prom_init: fix the improper check of prom_getprop
Date: Fri, 19 Nov 2021 17:12:18 +0800	[thread overview]
Message-ID: <tencent_BA28CC6897B7C95A92EB8C580B5D18589105@qq.com> (raw)

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

Signed-off-by: Peiwei Hu <jlu.hpw@foxmail.com>
---
 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


WARNING: multiple messages have this Message-ID (diff)
From: Peiwei Hu <jlu.hpw@foxmail.com>
To: mpe@ellerman.id.au, benh@kernel.crashing.org, paulus@samba.org,
	aneesh.kumar@linux.ibm.com, ardb@kernel.org,
	rafael.j.wysocki@intel.com, masahiroy@kernel.org,
	npiggin@gmail.com, andriy.shevchenko@linux.intel.com,
	adobriyan@gmail.com, clg@kaod.org
Cc: trivial@kernel.org, linuxppc-dev@lists.ozlabs.org,
	linux-kernel@vger.kernel.org, Peiwei Hu <jlu.hpw@foxmail.com>
Subject: [PATCH] powerpc/prom_init: fix the improper check of prom_getprop
Date: Fri, 19 Nov 2021 17:12:18 +0800	[thread overview]
Message-ID: <tencent_BA28CC6897B7C95A92EB8C580B5D18589105@qq.com> (raw)

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

Signed-off-by: Peiwei Hu <jlu.hpw@foxmail.com>
---
 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


             reply	other threads:[~2021-11-19  9:45 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-19  9:12 Peiwei Hu [this message]
2021-11-19  9:12 ` [PATCH] powerpc/prom_init: fix the improper check of prom_getprop Peiwei Hu
2021-11-19  9:46 ` Andy Shevchenko
2021-11-19  9:46   ` Andy Shevchenko
2021-11-25  9:36 ` Michael Ellerman
2021-11-25  9:36   ` Michael Ellerman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=tencent_BA28CC6897B7C95A92EB8C580B5D18589105@qq.com \
    --to=jlu.hpw@foxmail.com \
    --cc=adobriyan@gmail.com \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=aneesh.kumar@linux.ibm.com \
    --cc=ardb@kernel.org \
    --cc=benh@kernel.crashing.org \
    --cc=clg@kaod.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=masahiroy@kernel.org \
    --cc=mpe@ellerman.id.au \
    --cc=npiggin@gmail.com \
    --cc=paulus@samba.org \
    --cc=rafael.j.wysocki@intel.com \
    --cc=trivial@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.