[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <2b8fb8823fe73f28ef77bbdd78c9c8b2105e3077.camel@perches.com>
Date: Sun, 08 Nov 2020 12:58:55 -0800
From: Joe Perches <joe@...ches.com>
To: xiakaixu1987@...il.com, hca@...ux.ibm.com, gor@...ux.ibm.com,
borntraeger@...ibm.com
Cc: linux-s390@...r.kernel.org, linux-kernel@...r.kernel.org,
Kaixu Xia <kaixuxia@...cent.com>
Subject: Re: [PATCH] s390/qeth: remove useless if/else
On Sun, 2020-11-08 at 14:34 +0800, xiakaixu1987@...il.com wrote:
> From: Kaixu Xia <kaixuxia@...cent.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.
Powered by blists - more mailing lists