From: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
To: Colin King <colin.king@canonical.com>,
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: Re: [PATCH] x86/platform/olpc: remove duplicated check on node == -1
Date: Sun, 9 Dec 2018 18:13:12 +0100 [thread overview]
Message-ID: <5ec13475-37d8-01b7-e575-cd9e9f496cc3@wanadoo.fr> (raw)
In-Reply-To: <20181209150142.9010-1-colin.king@canonical.com>
Le 09/12/2018 à 16:01, Colin King a écrit :
> 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;
'res' is { &node }
Could 'node' be modified by 'olpc_ofw(..., res)' and set to -1?
In other words, I'm not sure that the 2nd check is a redundant here.
Just my 2c,
CJ
next prev parent reply other threads:[~2018-12-09 17:13 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-12-09 15:01 Colin King
2018-12-09 17:10 ` Christophe JAILLET
2018-12-09 17:13 ` Christophe JAILLET [this message]
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=5ec13475-37d8-01b7-e575-cd9e9f496cc3@wanadoo.fr \
--to=christophe.jaillet@wanadoo.fr \
--cc=akpm@linux-foundation.org \
--cc=bp@alien8.de \
--cc=colin.king@canonical.com \
--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
all inboxes | Powered by JetHome®