public inbox for linux-s390@vger.kernel.org
 help / color / mirror / Atom feed
From: Joe Perches <joe@perches.com>
To: xiakaixu1987@gmail.com, hca@linux.ibm.com, gor@linux.ibm.com,
	borntraeger@de.ibm.com
Cc: linux-s390@vger.kernel.org, linux-kernel@vger.kernel.org,
	Kaixu Xia <kaixuxia@tencent.com>
Subject: Re: [PATCH] s390/qeth: remove useless if/else
Date: Sun, 08 Nov 2020 12:58:55 -0800	[thread overview]
Message-ID: <2b8fb8823fe73f28ef77bbdd78c9c8b2105e3077.camel@perches.com> (raw)
In-Reply-To: <1604817287-11258-1-git-send-email-kaixuxia@tencent.com>

On Sun, 2020-11-08 at 14:34 +0800, xiakaixu1987@gmail.com wrote:
> From: Kaixu Xia <kaixuxia@tencent.com>
> 
> Fix the following coccinelle report:
> 
> ./drivers/s390/net/qeth_l3_main.c:107:2-4: WARNING: possible condition with no effect (if == else)
> 
> Both branches are the same, so remove them.
[]
> diff --git a/drivers/s390/net/qeth_l3_main.c b/drivers/s390/net/qeth_l3_main.c
[]
> @@ -104,10 +104,7 @@ static bool qeth_l3_is_addr_covered_by_ipato(struct qeth_card *card,
> �		qeth_l3_convert_addr_to_bits(ipatoe->addr, ipatoe_bits,
> �					  (ipatoe->proto == QETH_PROT_IPV4) ?
> �					  4 : 16);
> -		if (addr->proto == QETH_PROT_IPV4)
> -			rc = !memcmp(addr_bits, ipatoe_bits, ipatoe->mask_bits);
> -		else
> -			rc = !memcmp(addr_bits, ipatoe_bits, ipatoe->mask_bits);
> +		rc = !memcmp(addr_bits, ipatoe_bits, ipatoe->mask_bits);

It's not always best to remove one branch.

Is this a copy/paste defect or is it useless?
Do you know which?
If you do, you should state this in the commit message.

  reply	other threads:[~2020-11-08 20:58 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-08  6:34 [PATCH] s390/qeth: remove useless if/else xiakaixu1987
2020-11-08 20:58 ` Joe Perches [this message]
2020-11-09  8:05 ` Julian Wiedmann

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=2b8fb8823fe73f28ef77bbdd78c9c8b2105e3077.camel@perches.com \
    --to=joe@perches.com \
    --cc=borntraeger@de.ibm.com \
    --cc=gor@linux.ibm.com \
    --cc=hca@linux.ibm.com \
    --cc=kaixuxia@tencent.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-s390@vger.kernel.org \
    --cc=xiakaixu1987@gmail.com \
    /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