Skip to contentSkip to conversation

netxen_nic: remove redundant assignment to variable capability

PATCH Applied Colin Ian King 3 participants 3 messages Feb 6, 2024 – Feb 9, 2024

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 netxen_nic: remove redundant assignment to variable capability

The variable capability is being assigned a value that is never read and is being re-assigned later. The assignment is redundant and can be removed. Also remove empty line before assignment to capability.

Cleans up clang scan build warning:
drivers/net/ethernet/qlogic/netxen/netxen_nic_init.c:1189:2: warning:
Value stored to 'capability' is never read [deadcode.DeadStores]

---
 drivers/net/ethernet/qlogic/netxen/netxen_nic_init.c | 2 --
 1 file changed, 2 deletions(-)
drivers/net/ethernet/qlogic/netxen/netxen_nic_init.c +0 -2
index 35ec9aab3dc7..51fa880eaf6c 100644
@@ -1186,7 +1186,6 @@ static int
 netxen_p3_has_mn(struct netxen_adapter *adapter)
 {
 	u32 capability, flashed_ver;
-	capability = 0;
 
 	/* NX2031 always had MN */
 	if (NX_IS_REVISION_P2(adapter->ahw.revision_id))
@@ -1197,7 +1196,6 @@ netxen_p3_has_mn(struct netxen_adapter *adapter)
 	flashed_ver = NETXEN_DECODE_VERSION(flashed_ver);
 
 	if (flashed_ver >= NETXEN_VERSION_CODE(4, 0, 220)) {
-
 		capability = NXRD32(adapter, NX_PEG_TUNE_CAPABILITY);
 		if (capability & NX_PEG_TUNE_MN_PRESENT)
 			return 1;
Signature · 1 line
2.39.2
reviewer Reviewed-by on v1 1/1
#1 lore raw
Quoted 18 lines · Colin Ian King

The variable capability is being assigned a value that is never read and is being re-assigned later. The assignment is redundant and can be removed. Also remove empty line before assignment to capability.

Cleans up clang scan build warning:
drivers/net/ethernet/qlogic/netxen/netxen_nic_init.c:1189:2: warning:
Value stored to 'capability' is never read [deadcode.DeadStores]

---
 drivers/net/ethernet/qlogic/netxen/netxen_nic_init.c | 2 --
 1 file changed, 2 deletions(-)
drivers/net/ethernet/qlogic/netxen/netxen_nic_init.c +0 -0
index 35ec9aab3dc7..51fa880eaf6c 100644

drivers/net/ethernet/qlogic/netxen/netxen_nic_init.c static int · line 1189

Quoted 4 lines
drivers/net/ethernet/qlogic/netxen/netxen_nic_init.c +0 -1
@@ -1186,7 +1186,6 @@ static int
 netxen_p3_has_mn(struct netxen_adapter *adapter)
 {
 	u32 capability, flashed_ver;
-	capability = 0;

This part looks correct :)

drivers/net/ethernet/qlogic/netxen/netxen_nic_init.c netxen_p3_has_mn(struct netxen_adapter *adapter) · line 1200

Quoted 8 lines
drivers/net/ethernet/qlogic/netxen/netxen_nic_init.c +0 -1
 	/* NX2031 always had MN */
 	if (NX_IS_REVISION_P2(adapter->ahw.revision_id))
@@ -1197,7 +1196,6 @@ netxen_p3_has_mn(struct netxen_adapter *adapter)
 	flashed_ver = NETXEN_DECODE_VERSION(flashed_ver);
 
 	if (flashed_ver >= NETXEN_VERSION_CODE(4, 0, 220)) {
-

This part doesn't seem strictly related to the patch description. But in looking at it more closely, I wonder if it would be good to reduce the scope of capability to this context (and leave the bank line).

drivers/net/ethernet/qlogic/netxen/netxen_nic_init.c netxen_p3_has_mn(struct netxen_adapter *adapter) · line 1201

Quoted 3 lines
drivers/net/ethernet/qlogic/netxen/netxen_nic_init.c +0 -0
 		capability = NXRD32(adapter, NX_PEG_TUNE_CAPABILITY);
 		if (capability & NX_PEG_TUNE_MN_PRESENT)
 			return 1;

In any case, I agree that this patch is correct, and I'm happy with it with or without the change I suggested above.

#2 lore raw
In reply to Colin Ian King
This patch was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:

Hello:

This patch was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:

Quoted 9 lines · On Tue, 6 Feb 2024 11:50:49 +0000 you wrote:

The variable capability is being assigned a value that is never read and is being re-assigned later. The assignment is redundant and can be removed. Also remove empty line before assignment to capability.

Cleans up clang scan build warning:
drivers/net/ethernet/qlogic/netxen/netxen_nic_init.c:1189:2: warning:
Value stored to 'capability' is never read [deadcode.DeadStores]

[...]

Here is the summary with links:
- [next] netxen_nic: remove redundant assignment to variable capability

    https://git.kernel.org/netdev/net-next/c/a6c15d7ff29c

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html