linux-kernel-mentees.lists.linuxfoundation.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] net: ethernet/nvidia: fix possible condition with no effect
@ 2022-06-26 10:35 Praghadeesh T K S
  2022-06-26 11:08 ` Andrew Lunn
  0 siblings, 1 reply; 3+ messages in thread
From: Praghadeesh T K S @ 2022-06-26 10:35 UTC (permalink / raw)
  To: Rain River, Zhu Yanjun, David S. Miller, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni, netdev, linux-kernel
  Cc: praghadeeshtks, linux-kernel-mentees, Praghadeesh T K S

Fix Coccinelle bug, removed condition with no effect.

Signed-off-by: Praghadeesh T K S <praghadeeshthevendria@gmail.com>
---
 drivers/net/ethernet/nvidia/forcedeth.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/drivers/net/ethernet/nvidia/forcedeth.c b/drivers/net/ethernet/nvidia/forcedeth.c
index 5116bad..8e49cfa 100644
--- a/drivers/net/ethernet/nvidia/forcedeth.c
+++ b/drivers/net/ethernet/nvidia/forcedeth.c
@@ -3471,9 +3471,6 @@ static int nv_update_linkspeed(struct net_device *dev)
 	} else if (adv_lpa & LPA_10FULL) {
 		newls = NVREG_LINKSPEED_FORCE|NVREG_LINKSPEED_10;
 		newdup = 1;
-	} else if (adv_lpa & LPA_10HALF) {
-		newls = NVREG_LINKSPEED_FORCE|NVREG_LINKSPEED_10;
-		newdup = 0;
 	} else {
 		newls = NVREG_LINKSPEED_FORCE|NVREG_LINKSPEED_10;
 		newdup = 0;
-- 
2.34.1

_______________________________________________
Linux-kernel-mentees mailing list
Linux-kernel-mentees@lists.linuxfoundation.org
https://lists.linuxfoundation.org/mailman/listinfo/linux-kernel-mentees

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] net: ethernet/nvidia: fix possible condition with no effect
  2022-06-26 10:35 [PATCH] net: ethernet/nvidia: fix possible condition with no effect Praghadeesh T K S
@ 2022-06-26 11:08 ` Andrew Lunn
  2022-06-27 18:38   ` Jakub Kicinski
  0 siblings, 1 reply; 3+ messages in thread
From: Andrew Lunn @ 2022-06-26 11:08 UTC (permalink / raw)
  To: Praghadeesh T K S
  Cc: praghadeeshtks, netdev, linux-kernel, Eric Dumazet, Rain River,
	Zhu Yanjun, Jakub Kicinski, Paolo Abeni, linux-kernel-mentees,
	David S. Miller

On Sun, Jun 26, 2022 at 10:35:39AM +0000, Praghadeesh T K S wrote:
> Fix Coccinelle bug, removed condition with no effect.

This is not a coccinelle bug. If it was, you would be patching
coccinelle, not the kernel.

> Signed-off-by: Praghadeesh T K S <praghadeeshthevendria@gmail.com>
> ---
>  drivers/net/ethernet/nvidia/forcedeth.c | 3 ---
>  1 file changed, 3 deletions(-)
> 
> diff --git a/drivers/net/ethernet/nvidia/forcedeth.c b/drivers/net/ethernet/nvidia/forcedeth.c
> index 5116bad..8e49cfa 100644
> --- a/drivers/net/ethernet/nvidia/forcedeth.c
> +++ b/drivers/net/ethernet/nvidia/forcedeth.c
> @@ -3471,9 +3471,6 @@ static int nv_update_linkspeed(struct net_device *dev)
>  	} else if (adv_lpa & LPA_10FULL) {
>  		newls = NVREG_LINKSPEED_FORCE|NVREG_LINKSPEED_10;
>  		newdup = 1;
> -	} else if (adv_lpa & LPA_10HALF) {
> -		newls = NVREG_LINKSPEED_FORCE|NVREG_LINKSPEED_10;
> -		newdup = 0;
>  	} else {
>  		newls = NVREG_LINKSPEED_FORCE|NVREG_LINKSPEED_10;
>  		newdup = 0;

Please google this, see the past discussion about why this code is
there.

	Andrew
_______________________________________________
Linux-kernel-mentees mailing list
Linux-kernel-mentees@lists.linuxfoundation.org
https://lists.linuxfoundation.org/mailman/listinfo/linux-kernel-mentees

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] net: ethernet/nvidia: fix possible condition with no effect
  2022-06-26 11:08 ` Andrew Lunn
@ 2022-06-27 18:38   ` Jakub Kicinski
  0 siblings, 0 replies; 3+ messages in thread
From: Jakub Kicinski @ 2022-06-27 18:38 UTC (permalink / raw)
  To: Andrew Lunn
  Cc: praghadeeshtks, netdev, linux-kernel, Praghadeesh T K S,
	Eric Dumazet, Rain River, Zhu Yanjun, Paolo Abeni,
	linux-kernel-mentees, David S. Miller

On Sun, 26 Jun 2022 13:08:37 +0200 Andrew Lunn wrote:
> On Sun, Jun 26, 2022 at 10:35:39AM +0000, Praghadeesh T K S wrote:
> > Fix Coccinelle bug, removed condition with no effect.  
> 
> This is not a coccinelle bug. If it was, you would be patching
> coccinelle, not the kernel.

I'd say the commit message is better than the commit ;)
Praghadeesh, could you fix Coccinelle to avoid matching:

	if (/* case 1 */) {
		/* BLOCK 1*/
	} else (/* case 2 */ {
		/* BLOCK 2 */
	} else {
		/* default == BLOCK 2 */
	}

Because 99% of the time that construct is intentional.
_______________________________________________
Linux-kernel-mentees mailing list
Linux-kernel-mentees@lists.linuxfoundation.org
https://lists.linuxfoundation.org/mailman/listinfo/linux-kernel-mentees

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-06-27 18:38 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-26 10:35 [PATCH] net: ethernet/nvidia: fix possible condition with no effect Praghadeesh T K S
2022-06-26 11:08 ` Andrew Lunn
2022-06-27 18:38   ` Jakub Kicinski

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).