diff mbox series

[V2] net: 3com: 3c59x: remove set but not used variable 'mii_reg1'

Message ID 20200106125337.40297-1-yukuai3@huawei.com
State Superseded
Delegated to: David Miller
Headers show
Series [V2] net: 3com: 3c59x: remove set but not used variable 'mii_reg1' | expand

Commit Message

yukuai (C) Jan. 6, 2020, 12:53 p.m. UTC
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.

Signed-off-by: yu kuai <yukuai3@huawei.com>
---
changes in V2
-The read might have side effects, don't remove it.

 drivers/net/ethernet/3com/3c59x.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

Comments

Michal Kubecek Jan. 6, 2020, 1:13 p.m. UTC | #1
On Mon, Jan 06, 2020 at 08:53:37PM +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.
> 
> Signed-off-by: yu kuai <yukuai3@huawei.com>
> ---
> changes in V2
> -The read might have side effects, don't remove it.
[...]
> @@ -1605,7 +1605,6 @@ vortex_up(struct net_device *dev)
>  	window_write32(vp, config, 3, Wn3_Config);
>  
>  	if (dev->if_port == XCVR_MII || dev->if_port == XCVR_NWAY) {
> -		mii_reg1 = mdio_read(dev, vp->phys[0], MII_BMSR);
>  		mdio_read(dev, vp->phys[0], MII_LPA);
>  		vp->partner_flow_ctrl = ((mii_reg5 & 0x0400) != 0);
>  		vp->mii.full_duplex = vp->full_duplex;

Here you removed the read, as you did in previous version of the patch.

Michal Kubecek
yukuai (C) Jan. 6, 2020, 2:20 p.m. UTC | #2
On 2020/1/6 21:13, Michal Kubecek wrote:
>> @@ -1605,7 +1605,6 @@ vortex_up(struct net_device *dev)
>>   	window_write32(vp, config, 3, Wn3_Config);
>>   
>>   	if (dev->if_port == XCVR_MII || dev->if_port == XCVR_NWAY) {
>> -		mii_reg1 = mdio_read(dev, vp->phys[0], MII_BMSR);
>>   		mdio_read(dev, vp->phys[0], MII_LPA);
>>   		vp->partner_flow_ctrl = ((mii_reg5 & 0x0400) != 0);
>>   		vp->mii.full_duplex = vp->full_duplex;
> Here you removed the read, as you did in previous version of the patch.

Sorry about the stupit mistake.

Yu Kuai
David Miller Jan. 8, 2020, 8:40 p.m. UTC | #3
From: yu kuai <yukuai3@huawei.com>
Date: Mon, 6 Jan 2020 20:53:37 +0800

> 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.
> 
> Signed-off-by: yu kuai <yukuai3@huawei.com>
> ---
> changes in V2
> -The read might have side effects, don't remove it.

Applied to net-next, thank you.
Matthew Wilcox Jan. 8, 2020, 9:59 p.m. UTC | #4
On Wed, Jan 08, 2020 at 12:40:21PM -0800, David Miller wrote:
> From: yu kuai <yukuai3@huawei.com>
> Date: Mon, 6 Jan 2020 20:53:37 +0800
> 
> > 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.
> > 
> > Signed-off-by: yu kuai <yukuai3@huawei.com>
> > ---
> > changes in V2
> > -The read might have side effects, don't remove it.
> 
> Applied to net-next, thank you.

This waas a mistaken version; please revert and apply v3 instead.
David Miller Jan. 8, 2020, 11:05 p.m. UTC | #5
From: Matthew Wilcox <willy@infradead.org>
Date: Wed, 8 Jan 2020 13:59:29 -0800

> This waas a mistaken version; please revert and apply v3 instead.

Are you sure?

[davem@localhost net-next]$ git show e102774588b3ac0d221ed2d03a5153e056f1354f >x.diff
[davem@localhost net-next]$ patch -p1 -R <x.diff 
patching file drivers/net/ethernet/3com/3c59x.c
[davem@localhost net-next]$ mv ~/Downloads/V3-net-3com-3c59x-remove-set-but-not-used-variable-mii_reg1.patch ./
[davem@localhost net-next]$ patch -p1 <V3-net-3com-3c59x-remove-set-but-not-used-variable-mii_reg1.patch 
patching file drivers/net/ethernet/3com/3c59x.c
[davem@localhost net-next]$ git diff
[davem@localhost net-next]$

There is no difference in the code of the commit at all between V2 and V3.
Matthew Wilcox Jan. 9, 2020, 1:03 a.m. UTC | #6
On Wed, Jan 08, 2020 at 03:05:49PM -0800, David Miller wrote:
> From: Matthew Wilcox <willy@infradead.org>
> Date: Wed, 8 Jan 2020 13:59:29 -0800
> 
> > This waas a mistaken version; please revert and apply v3 instead.
> 
> Are you sure?
> 
> [davem@localhost net-next]$ git show e102774588b3ac0d221ed2d03a5153e056f1354f >x.diff
> [davem@localhost net-next]$ patch -p1 -R <x.diff 
> patching file drivers/net/ethernet/3com/3c59x.c
> [davem@localhost net-next]$ mv ~/Downloads/V3-net-3com-3c59x-remove-set-but-not-used-variable-mii_reg1.patch ./
> [davem@localhost net-next]$ patch -p1 <V3-net-3com-3c59x-remove-set-but-not-used-variable-mii_reg1.patch 
> patching file drivers/net/ethernet/3com/3c59x.c
> [davem@localhost net-next]$ git diff
> [davem@localhost net-next]$
> 
> There is no difference in the code of the commit at all between V2 and V3.

v2:
-               mii_reg1 = mdio_read(dev, vp->phys[0], MII_BMSR);

v3:
-               mii_reg1 = mdio_read(dev, vp->phys[0], MII_BMSR);
+               mdio_read(dev, vp->phys[0], MII_BMSR);
yukuai (C) Jan. 9, 2020, 1:14 a.m. UTC | #7
On 2020/1/9 9:03, Matthew Wilcox wrote:

> v2:
> -               mii_reg1 = mdio_read(dev, vp->phys[0], MII_BMSR);
> 
> v3:
> -               mii_reg1 = mdio_read(dev, vp->phys[0], MII_BMSR);
> +               mdio_read(dev, vp->phys[0], MII_BMSR);

Yes, V2 was a mistaken, my bad.
Please apply v3 instead.

Thanks!
Yu Kuai
David Miller Jan. 9, 2020, 1:55 a.m. UTC | #8
From: Matthew Wilcox <willy@infradead.org>
Date: Wed, 8 Jan 2020 17:03:44 -0800

> On Wed, Jan 08, 2020 at 03:05:49PM -0800, David Miller wrote:
>> From: Matthew Wilcox <willy@infradead.org>
>> Date: Wed, 8 Jan 2020 13:59:29 -0800
>> 
>> > This waas a mistaken version; please revert and apply v3 instead.
>> 
>> Are you sure?
>> 
>> [davem@localhost net-next]$ git show e102774588b3ac0d221ed2d03a5153e056f1354f >x.diff
>> [davem@localhost net-next]$ patch -p1 -R <x.diff 
>> patching file drivers/net/ethernet/3com/3c59x.c
>> [davem@localhost net-next]$ mv ~/Downloads/V3-net-3com-3c59x-remove-set-but-not-used-variable-mii_reg1.patch ./
>> [davem@localhost net-next]$ patch -p1 <V3-net-3com-3c59x-remove-set-but-not-used-variable-mii_reg1.patch 
>> patching file drivers/net/ethernet/3com/3c59x.c
>> [davem@localhost net-next]$ git diff
>> [davem@localhost net-next]$
>> 
>> There is no difference in the code of the commit at all between V2 and V3.
> 
> v2:
> -               mii_reg1 = mdio_read(dev, vp->phys[0], MII_BMSR);
> 
> v3:
> -               mii_reg1 = mdio_read(dev, vp->phys[0], MII_BMSR);
> +               mdio_read(dev, vp->phys[0], MII_BMSR);

Then check what is in the GIT tree I probably applied V3 and replied accidently
to V2 :-)
diff mbox series

Patch

diff --git a/drivers/net/ethernet/3com/3c59x.c b/drivers/net/ethernet/3com/3c59x.c
index fc046797c0ea..6e537e5dc208 100644
--- a/drivers/net/ethernet/3com/3c59x.c
+++ b/drivers/net/ethernet/3com/3c59x.c
@@ -1548,7 +1548,7 @@  vortex_up(struct net_device *dev)
 	struct vortex_private *vp = netdev_priv(dev);
 	void __iomem *ioaddr = vp->ioaddr;
 	unsigned int config;
-	int i, mii_reg1, mii_reg5, err = 0;
+	int i, mii_reg5, err = 0;
 
 	if (VORTEX_PCI(vp)) {
 		pci_set_power_state(VORTEX_PCI(vp), PCI_D0);	/* Go active */
@@ -1605,7 +1605,6 @@  vortex_up(struct net_device *dev)
 	window_write32(vp, config, 3, Wn3_Config);
 
 	if (dev->if_port == XCVR_MII || dev->if_port == XCVR_NWAY) {
-		mii_reg1 = mdio_read(dev, vp->phys[0], MII_BMSR);
 		mdio_read(dev, vp->phys[0], MII_LPA);
 		vp->partner_flow_ctrl = ((mii_reg5 & 0x0400) != 0);
 		vp->mii.full_duplex = vp->full_duplex;