diff mbox series

[next] netxen_nic: remove redundant assignment to variable capability

Message ID 20240206115049.1879389-1-colin.i.king@gmail.com (mailing list archive)
State Accepted
Commit a6c15d7ff29c1986fcf2df5c1ecb96dec835826f
Delegated to: Netdev Maintainers
Headers show
Series [next] netxen_nic: remove redundant assignment to variable capability | expand

Checks

Context Check Description
netdev/series_format warning Single patches do not need cover letters; Target tree name not specified in the subject
netdev/tree_selection success Guessed tree name to be net-next
netdev/ynl success Generated files up to date; no warnings/errors; no diff in generated;
netdev/fixes_present success Fixes tag not required for -next series
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 1119 this patch: 1119
netdev/build_tools success No tools touched, skip
netdev/cc_maintainers warning 5 maintainers not CCed: morbo@google.com justinstitt@google.com nathan@kernel.org ndesaulniers@google.com llvm@lists.linux.dev
netdev/build_clang success Errors and warnings before: 1065 this patch: 1065
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/deprecated_api success None detected
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success No Fixes tag
netdev/build_allmodconfig_warn success Errors and warnings before: 1136 this patch: 1136
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 14 lines checked
netdev/build_clang_rust success No Rust files in patch. Skipping build
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0
netdev/contest success net-next-2024-02-09--00-00 (tests: 687)

Commit Message

Colin Ian King Feb. 6, 2024, 11:50 a.m. UTC
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]

Signed-off-by: Colin Ian King <colin.i.king@gmail.com>
---
 drivers/net/ethernet/qlogic/netxen/netxen_nic_init.c | 2 --
 1 file changed, 2 deletions(-)

Comments

Simon Horman Feb. 7, 2024, 9:46 a.m. UTC | #1
On Tue, Feb 06, 2024 at 11:50:49AM +0000, Colin Ian King 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]
> 
> Signed-off-by: Colin Ian King <colin.i.king@gmail.com>
> ---
>  drivers/net/ethernet/qlogic/netxen/netxen_nic_init.c | 2 --
>  1 file changed, 2 deletions(-)
> 
> diff --git a/drivers/net/ethernet/qlogic/netxen/netxen_nic_init.c b/drivers/net/ethernet/qlogic/netxen/netxen_nic_init.c
> index 35ec9aab3dc7..51fa880eaf6c 100644
> --- a/drivers/net/ethernet/qlogic/netxen/netxen_nic_init.c
> +++ b/drivers/net/ethernet/qlogic/netxen/netxen_nic_init.c
> @@ -1186,7 +1186,6 @@ static int
>  netxen_p3_has_mn(struct netxen_adapter *adapter)
>  {
>  	u32 capability, flashed_ver;
> -	capability = 0;

This part looks correct :)

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

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

Reviewed-by: Simon Horman <horms@kernel.org>
patchwork-bot+netdevbpf@kernel.org Feb. 9, 2024, 3:11 a.m. UTC | #2
Hello:

This patch was applied to netdev/net-next.git (main)
by Jakub Kicinski <kuba@kernel.org>:

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!
diff mbox series

Patch

diff --git a/drivers/net/ethernet/qlogic/netxen/netxen_nic_init.c b/drivers/net/ethernet/qlogic/netxen/netxen_nic_init.c
index 35ec9aab3dc7..51fa880eaf6c 100644
--- a/drivers/net/ethernet/qlogic/netxen/netxen_nic_init.c
+++ b/drivers/net/ethernet/qlogic/netxen/netxen_nic_init.c
@@ -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;