diff mbox series

net: ksz884x: remove unused change variable

Message ID 20230329125929.1808420-1-trix@redhat.com (mailing list archive)
State Accepted
Commit 9a865a98a3360d06f92549839abda1bc96104aea
Delegated to: Netdev Maintainers
Headers show
Series net: ksz884x: remove unused change variable | 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/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: 57 this patch: 57
netdev/cc_maintainers warning 1 maintainers not CCed: mw@semihalf.com
netdev/build_clang success Errors and warnings before: 55 this patch: 54
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: 57 this patch: 57
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 27 lines checked
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0

Commit Message

Tom Rix March 29, 2023, 12:59 p.m. UTC
clang with W=1 reports
drivers/net/ethernet/micrel/ksz884x.c:3216:6: error: variable
  'change' set but not used [-Werror,-Wunused-but-set-variable]
        int change = 0;
            ^
This variable is not used so remove it.

Signed-off-by: Tom Rix <trix@redhat.com>
---
 drivers/net/ethernet/micrel/ksz884x.c | 10 +++-------
 1 file changed, 3 insertions(+), 7 deletions(-)

Comments

Simon Horman March 29, 2023, 1:23 p.m. UTC | #1
On Wed, Mar 29, 2023 at 08:59:29AM -0400, Tom Rix wrote:
> clang with W=1 reports
> drivers/net/ethernet/micrel/ksz884x.c:3216:6: error: variable
>   'change' set but not used [-Werror,-Wunused-but-set-variable]
>         int change = 0;
>             ^
> This variable is not used so remove it.
> 
> Signed-off-by: Tom Rix <trix@redhat.com>

Reviewed-by: Simon Horman <simon.horman@corigine.com>
Simon Horman March 29, 2023, 1:41 p.m. UTC | #2
On Wed, Mar 29, 2023 at 03:23:38PM +0200, Simon Horman wrote:
> On Wed, Mar 29, 2023 at 08:59:29AM -0400, Tom Rix wrote:
> > clang with W=1 reports
> > drivers/net/ethernet/micrel/ksz884x.c:3216:6: error: variable
> >   'change' set but not used [-Werror,-Wunused-but-set-variable]
> >         int change = 0;
> >             ^
> > This variable is not used so remove it.
> > 
> > Signed-off-by: Tom Rix <trix@redhat.com>
> 
> Reviewed-by: Simon Horman <simon.horman@corigine.com>

Hi Tom,

I notice a very large number of unused functions in ksz884x.c.
And I think this means some corresponding #defines can also be removed.

I'm wondering if you happen to be looking at this.
If not, I'll see about preparing a patch.
patchwork-bot+netdevbpf@kernel.org March 31, 2023, 6:30 a.m. UTC | #3
Hello:

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

On Wed, 29 Mar 2023 08:59:29 -0400 you wrote:
> clang with W=1 reports
> drivers/net/ethernet/micrel/ksz884x.c:3216:6: error: variable
>   'change' set but not used [-Werror,-Wunused-but-set-variable]
>         int change = 0;
>             ^
> This variable is not used so remove it.
> 
> [...]

Here is the summary with links:
  - net: ksz884x: remove unused change variable
    https://git.kernel.org/netdev/net-next/c/9a865a98a336

You are awesome, thank you!
diff mbox series

Patch

diff --git a/drivers/net/ethernet/micrel/ksz884x.c b/drivers/net/ethernet/micrel/ksz884x.c
index e6acd1e7b263..f78e8ead8c36 100644
--- a/drivers/net/ethernet/micrel/ksz884x.c
+++ b/drivers/net/ethernet/micrel/ksz884x.c
@@ -3213,7 +3213,6 @@  static void port_get_link_speed(struct ksz_port *port)
 	u8 remote;
 	int i;
 	int p;
-	int change = 0;
 
 	interrupt = hw_block_intr(hw);
 
@@ -3260,17 +3259,14 @@  static void port_get_link_speed(struct ksz_port *port)
 					port_cfg_back_pressure(hw, p,
 						(1 == info->duplex));
 				}
-				change |= 1 << i;
 				port_cfg_change(hw, port, info, status);
 			}
 			info->state = media_connected;
 		} else {
-			if (media_disconnected != info->state) {
-				change |= 1 << i;
-
-				/* Indicate the link just goes down. */
+			/* Indicate the link just goes down. */
+			if (media_disconnected != info->state)
 				hw->port_mib[p].link_down = 1;
-			}
+
 			info->state = media_disconnected;
 		}
 		hw->port_mib[p].state = (u8) info->state;