lkml.org 
[lkml]   [2020]   [Jan]   [3]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] net: 3com: 3c59x: remove set but not used variable 'mii_reg1'
On Fri, Jan 03, 2020 at 08:19:07PM +0800, yu kuai wrote:
> Fixes gcc '-Wunused-but-set-variable' warning:
>
> drivers/net/ethernet/3com/3c59x.c: In function ‘vortex_up’:
> drivers/net/ethernet/3com/3c59x.c:1551:9: warning: variable
> ‘mii_reg1’ set but not used [-Wunused-but-set-variable]
>
> It is never used, and so can be removed.
...
> if (dev->if_port == XCVR_MII || dev->if_port == XCVR_NWAY) {
> - mii_reg1 = mdio_read(dev, vp->phys[0], MII_BMSR);
> mii_reg5 = mdio_read(dev, vp->phys[0], MII_LPA);

I know nothing about the MII interface, but in general this is not
a safe thing to do. You're removing a read from a device register.
Register reads can have side effects. I'm actually quite surprised
that GCC emits this warning, since there should be some kind of
volatile cast in mdio_read() to let GCC know that something unusual
is going on here.

\
 
 \ /
  Last update: 2020-01-03 15:47    [W:0.151 / U:0.124 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site