net: ethernet/nvidia: fix possible condition with no effect
Subsystems (3)
PATCH 1/1 net: ethernet/nvidia: fix possible condition with no effect
Fix Coccinelle bug, removed condition with no effect.
--- drivers/net/ethernet/nvidia/forcedeth.c | 3 --- 1 file changed, 3 deletions(-)
drivers/net/ethernet/nvidia/forcedeth.c +0 -3
@@ -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 ;
Signature · 6 lines
2.34.1 _______________________________________________ Linux-kernel-mentees mailing list [email protected] https://lists.linuxfoundation.org/mailman/listinfo/linux-kernel-mentees
Quoted 1 line · Praghadeesh T K S
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.
Quoted 10 lines
Signed-off-by Praghadeesh T K S <[email protected]>--- drivers/net/ethernet/nvidia/forcedeth.c | 3 --- 1 file changed, 3 deletions(-)drivers/net/ethernet/nvidia/forcedeth.c +0
-0
drivers/net/ethernet/nvidia/forcedeth.c static int nv_update_linkspeed(struct net_device *dev) · line 3476
Quoted 9 lines
drivers/net/ethernet/nvidia/forcedeth.c +0
-3@@ -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
Jakub Kicinski
maintainerQuoted 5 lines · On Sun, 26 Jun 2022 13:08:37 +0200 Andrew Lunn wrote:
Quoted 1 line · Praghadeesh T K S
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 [email protected]
https://lists.linuxfoundation.org/mailman/listinfo/linux-kernel-mentees