From: Colin King <colin.king@canonical.com>
To: Thomas Gleixner <tglx@linutronix.de>,
Ingo Molnar <mingo@redhat.com>, Borislav Petkov <bp@alien8.de>,
"H . Peter Anvin" <hpa@zytor.com>,
x86@kernel.org, Andrew Morton <akpm@linux-foundation.org>
Cc: kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH] x86/platform/olpc: remove duplicated check on node == -1
Date: Sun, 9 Dec 2018 15:01:42 +0000 [thread overview]
Message-ID: <20181209150142.9010-1-colin.king@canonical.com> (raw)
From: Colin Ian King <colin.king@canonical.com>
Currently the node == -1 check is being performed twice, the
second check is redundant and can be removed. Fix this by
removing the redundant second check and moving the first check
into a combined check with the result from the olpc_ofw call.
Detected by cppcheck:
Identical condition '(s32)node==-1', second condition is always false
Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
arch/x86/platform/olpc/olpc_dt.c | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/arch/x86/platform/olpc/olpc_dt.c b/arch/x86/platform/olpc/olpc_dt.c
index b4ab779f1d47..658363ec3ff3 100644
--- a/arch/x86/platform/olpc/olpc_dt.c
+++ b/arch/x86/platform/olpc/olpc_dt.c
@@ -28,10 +28,7 @@ static phandle __init olpc_dt_getsibling(phandle node)
const void *args[] = { (void *)node };
void *res[] = { &node };
- if ((s32)node == -1)
- return 0;
-
- if (olpc_ofw("peer", args, res) || (s32)node == -1)
+ if (((s32)node == -1) || olpc_ofw("peer", args, res))
return 0;
return node;
--
2.19.1
next reply other threads:[~2018-12-09 15:01 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-12-09 15:01 Colin King [this message]
2018-12-09 17:10 ` [PATCH] x86/platform/olpc: remove duplicated check on node == -1 Christophe JAILLET
2018-12-09 17:13 ` Christophe JAILLET
2018-12-09 17:30 ` NACK: " Colin Ian King
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=20181209150142.9010-1-colin.king@canonical.com \
--to=colin.king@canonical.com \
--cc=akpm@linux-foundation.org \
--cc=bp@alien8.de \
--cc=hpa@zytor.com \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=tglx@linutronix.de \
--cc=x86@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).