i40e: Avoid unnecessary use of comma operator
Subsystems (3)
Simon Horman
reviewerPATCH 1/1 i40e: Avoid unnecessary use of comma operator
Although it does not seem to have any untoward side-effects, the use of ';' to separate to assignments seems more appropriate than ','.
Flagged by clang-17 -Wcomma
No functional change intended.
Compile tested only.
--- drivers/net/ethernet/intel/i40e/i40e_ethtool.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/intel/i40e/i40e_ethtool.c +1 -1
@@ -1917,7 +1917,7 @@ int i40e_get_eeprom(struct net_device *netdev, len = eeprom->len - (I40E_NVM_SECTOR_SIZE * i); last = true; } - offset = eeprom->offset + (I40E_NVM_SECTOR_SIZE * i), + offset = eeprom->offset + (I40E_NVM_SECTOR_SIZE * i); ret_val =i40e_aq_read_nvm (hw,0x0 , offset, len, (u8 *)eeprom_buff + (I40E_NVM_SECTOR_SIZE * i), last,NULL );
Quoted 5 lines · Simon Horman
Although it does not seem to have any untoward side-effects, the use of ';' to separate to assignments seems more appropriate than ','.
Flagged by clang-17 -Wcomma
Yikes! This kind of example is why I hate the comma operator!
(Is -Wcomma enabled by -Wall?)
Is there a fixes tag we can add?
Quoted 24 lines
No functional change intended.
Compile tested only.Signed-off-by Simon Horman <[email protected]>--- drivers/net/ethernet/intel/i40e/i40e_ethtool.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/net/ethernet/intel/i40e/i40e_ethtool.c +1
-1@@ -1917,7 +1917,7 @@ int i40e_get_eeprom(struct net_device *netdev, len = eeprom->len - (I40E_NVM_SECTOR_SIZE * i); last = true; } - offset = eeprom->offset + (I40E_NVM_SECTOR_SIZE * i), + offset = eeprom->offset + (I40E_NVM_SECTOR_SIZE * i); ret_val =i40e_aq_read_nvm (hw,0x0 , offset, len, (u8 *)eeprom_buff + (I40E_NVM_SECTOR_SIZE * i), last,NULL );
Signature · 2 lines
Thanks, ~Nick Desaulniers
Quoted 5 lines · Nick Desaulniers
Quoted 4 lines · Simon Horman
Although it does not seem to have any untoward side-effects, the use of ';' to separate to assignments seems more appropriate than ','.
Quoted 7 lines
Quoted 1 line
Flagged by clang-17 -Wcomma
Yikes! This kind of example is why I hate the comma operator!
Reviewed-by Nick Desaulniers <[email protected]>(Is -Wcomma enabled by -Wall?)
No and last time that I looked into enabling it, there were a lot of instances in the kernel:
https://lore.kernel.org/[email protected]/
It is still probably worth pursuing at some point but that is a lot of instances to clean up (along with potentially having a decent amount of pushback depending on the changes necessary to eliminate all instances).
Quoted 32 lines
Is there a fixes tag we can add?
Quoted 24 lines
No functional change intended.
Compile tested only.Signed-off-by Simon Horman <[email protected]>--- drivers/net/ethernet/intel/i40e/i40e_ethtool.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/net/ethernet/intel/i40e/i40e_ethtool.c +1
-1@@ -1917,7 +1917,7 @@ int i40e_get_eeprom(struct net_device *netdev, len = eeprom->len - (I40E_NVM_SECTOR_SIZE * i); last = true; } - offset = eeprom->offset + (I40E_NVM_SECTOR_SIZE * i), + offset = eeprom->offset + (I40E_NVM_SECTOR_SIZE * i); ret_val =i40e_aq_read_nvm (hw,0x0 , offset, len, (u8 *)eeprom_buff + (I40E_NVM_SECTOR_SIZE * i), last,NULL );Signature · 2 lines
Thanks, ~Nick Desaulniers
Quoted 4 lines · Nathan Chancellor
Quoted 1 line · Nick Desaulniers
(Is -Wcomma enabled by -Wall?)
Quoted 8 lines
No and last time that I looked into enabling it, there were a lot of instances in the kernel:
https://lore.kernel.org/[email protected]/
It is still probably worth pursuing at some point but that is a lot of instances to clean up (along with potentially having a decent amount of pushback depending on the changes necessary to eliminate all instances).
Filed this todo:
https://github.com/ClangBuiltLinux/linux/issues/1968
I'd be happy if Simon keeps poking at getting that warning enabled.
Signature · 2 lines
Thanks, ~Nick Desaulniers
Simon Horman
reviewerQuoted 10 lines · Nick Desaulniers
Quoted 9 lines · Nathan Chancellor
Quoted 1 line · Nick Desaulniers
(Is -Wcomma enabled by -Wall?)
No and last time that I looked into enabling it, there were a lot of instances in the kernel:
Quoted 7 lines
Quoted 3 lines
It is still probably worth pursuing at some point but that is a lot of instances to clean up (along with potentially having a decent amount of pushback depending on the changes necessary to eliminate all instances).
Filed this todo:
https://github.com/ClangBuiltLinux/linux/issues/1968
I'd be happy if Simon keeps poking at getting that warning enabled.
FWIIW, since the discussion cited above I have been keeping an eye on -Wcomma, mostly wrt to patches for Networking code.
My subjective feelings on this are:
* Few new instances seem to be added
* There are some, though I wouldn't say a lot, of existing instances in files that are that is being updated.
* I don't recall any of the instances, new or old, being bugs. Though perhaps a very small number were.
So while I'm all for more checks.
And I'm all for only using the comma where it is necessary (I suspect that often it is a typo).
I do not get the feeling that we are sitting on a trove of nasty bugs.
Quoted 5 lines · Simon Horman
So while I'm all for more checks.
And I'm all for only using the comma where it is necessary (I suspect that often it is a typo).
I do not get the feeling that we are sitting on a trove of nasty bugs.
I still get nightmares frome:
- commit e7140639b1de ("powerpc/xmon: Fix opcode being uninitialized in print_insn_powerpc")
- commit f7019b7b0ad1 ("xsk: Properly terminate assignment in xskq_produce_flush_desc")
Signature · 2 lines
Thanks, ~Nick Desaulniers
Simon Horman
reviewerQuoted 7 lines · Nick Desaulniers
Quoted 5 lines · Simon Horman
Although it does not seem to have any untoward side-effects, the use of ';' to separate to assignments seems more appropriate than ','.
Flagged by clang-17 -Wcomma
Quoted 7 lines
Yikes! This kind of example is why I hate the comma operator!
Reviewed-by Nick Desaulniers <[email protected]>(Is -Wcomma enabled by -Wall?)
Is there a fixes tag we can add?
Hi Nick,
I don't believe this resolves a user-visible bug, so for Networking code a fixes tag isn't appropriate.
Quoted 30 lines
Quoted 25 lines
No functional change intended.
Compile tested only.Signed-off-by Simon Horman <[email protected]>--- drivers/net/ethernet/intel/i40e/i40e_ethtool.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/net/ethernet/intel/i40e/i40e_ethtool.c +1
-1@@ -1917,7 +1917,7 @@ int i40e_get_eeprom(struct net_device *netdev, len = eeprom->len - (I40E_NVM_SECTOR_SIZE * i); last = true; } - offset = eeprom->offset + (I40E_NVM_SECTOR_SIZE * i), + offset = eeprom->offset + (I40E_NVM_SECTOR_SIZE * i); ret_val =i40e_aq_read_nvm (hw,0x0 , offset, len, (u8 *)eeprom_buff + (I40E_NVM_SECTOR_SIZE * i), last,NULL );Signature · 2 lines
Thanks, ~Nick Desaulniers
Quoted 12 lines
-----Original Message-----
From: Intel-wired-lan <[email protected]> On Behalf Of Simon Horman
Sent: Sunday, December 17, 2023 3:15 PM
To: Brandeburg, Jesse <[email protected]>; Nguyen, Anthony L <[email protected]>
Cc: [email protected]; [email protected]; Nick Desaulniers <[email protected]>; Nathan Chancellor <[email protected]>; Eric Dumazet <[email protected]>; [email protected]; Bill Wendling <[email protected]>; Justin Stitt <[email protected]>; Jakub Kicinski <[email protected]>; Paolo Abeni <[email protected]>; David S. Miller <[email protected]>
Subject: [Intel-wired-lan] [PATCH iwl-next] i40e: Avoid unnecessary use of comma operatorAlthough it does not seem to have any untoward side-effects, the use of ';' to separate to assignments seems more appropriate than ','.
Flagged by clang-17 -Wcomma
Quoted 8 lines
No functional change intended.
Compile tested only.Signed-off-by Simon Horman <[email protected]>--- drivers/net/ethernet/intel/i40e/i40e_ethtool.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)