netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andrew Lunn <andrew@lunn.ch>
To: Matthew Wilcox <willy@infradead.org>
Cc: yu kuai <yukuai3@huawei.com>,
	klassert@kernel.org, davem@davemloft.net, hkallweit1@gmail.com,
	jakub.kicinski@netronome.com, hslester96@gmail.com,
	mst@redhat.com, yang.wei9@zte.com.cn, netdev@vger.kernel.org,
	linux-kernel@vger.kernel.org, yi.zhang@huawei.com,
	zhengbin13@huawei.com
Subject: Re: [PATCH] net: 3com: 3c59x: remove set but not used variable 'mii_reg1'
Date: Fri, 3 Jan 2020 18:53:18 +0100	[thread overview]
Message-ID: <20200103175318.GN1397@lunn.ch> (raw)
In-Reply-To: <20200103144623.GI6788@bombadil.infradead.org>

On Fri, Jan 03, 2020 at 06:46:23AM -0800, Matthew Wilcox wrote:
> 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.

Hi Matthew

I fully agree about the general case. However, reading the MII_BMSR
should not have any side affects. It would be an odd Ethernet PHY if
it did.

But I am curious why this read is here. There is a slim change the
MDIO bus is broken, and this is a workaround. So it would be good if
somebody dug into the history and found out when this read was added
and if there are any comments about why it is there. Or if the usage
of mii_reg1 as been removed at some point, and the read was not
cleaned up.

   Andrew

  parent reply	other threads:[~2020-01-03 17:53 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-03 12:19 [PATCH] net: 3com: 3c59x: remove set but not used variable 'mii_reg1' yu kuai
2020-01-03 14:46 ` Matthew Wilcox
2020-01-03 14:59   ` Michal Kubecek
2020-01-03 17:53   ` Andrew Lunn [this message]
2020-01-03 18:17     ` Michal Kubecek
2020-01-03 19:13     ` Vladimir Oltean
2020-01-03 19:17       ` Florian Fainelli
2020-01-03 19:37         ` Andrew Lunn
     [not found]           ` <CAP8WD_a6QJNz2mUpz_eCaNReoZKVAdL0TpoF-m+gA4VPWRrrMg@mail.gmail.com>
2020-01-03 20:03             ` tedheadster
2020-01-06 12:48           ` yukuai (C)

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200103175318.GN1397@lunn.ch \
    --to=andrew@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=hkallweit1@gmail.com \
    --cc=hslester96@gmail.com \
    --cc=jakub.kicinski@netronome.com \
    --cc=klassert@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mst@redhat.com \
    --cc=netdev@vger.kernel.org \
    --cc=willy@infradead.org \
    --cc=yang.wei9@zte.com.cn \
    --cc=yi.zhang@huawei.com \
    --cc=yukuai3@huawei.com \
    --cc=zhengbin13@huawei.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).