Skip to contentSkip to conversation

Kill unneeded local variables in the LXT PHY driver

PATCH New Sergei Shtylyov 1 participant 3 messages May 13, 2016

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

cover Kill unneeded local variables in the LXT PHY driver

Hello.

[Resending with the correct subject. Sorry about that :-/]

Here's the set of 2 patches against DaveM's 'net-next.git' repo. We save
several LoCs on the unneeded local variables....

[1/2] lxt: simplify lxt97[01]_config_intr()
[2/2] lxt: simplify lxt970_config_init()

MBR, Sergei

#1 lore raw

PATCH 1/2 lxt: simplify lxt97[01]_config_intr()

Both these functions declare the 'err' local variables for no good reason, get rid of them.

---
 drivers/net/phy/lxt.c |   16 ++++------------
 1 file changed, 4 insertions(+), 12 deletions(-)
drivers/net/phy/lxt.c +4 -12
Index: net-next/drivers/net/phy/lxt.c
===================================================================
@@ -80,14 +80,10 @@ static int lxt970_ack_interrupt(struct p
 
 static int lxt970_config_intr(struct phy_device *phydev)
 {
-	int err;
-
 	if (phydev->interrupts == PHY_INTERRUPT_ENABLED)
-		err = phy_write(phydev, MII_LXT970_IER, MII_LXT970_IER_IEN);
+		return phy_write(phydev, MII_LXT970_IER, MII_LXT970_IER_IEN);
 	else
-		err = phy_write(phydev, MII_LXT970_IER, 0);
-
-	return err;
+		return phy_write(phydev, MII_LXT970_IER, 0);
 }
 
 static int lxt970_config_init(struct phy_device *phydev)
@@ -112,14 +108,10 @@ static int lxt971_ack_interrupt(struct p
 
 static int lxt971_config_intr(struct phy_device *phydev)
 {
-	int err;
-
 	if (phydev->interrupts == PHY_INTERRUPT_ENABLED)
-		err = phy_write(phydev, MII_LXT971_IER, MII_LXT971_IER_IEN);
+		return phy_write(phydev, MII_LXT971_IER, MII_LXT971_IER_IEN);
 	else
-		err = phy_write(phydev, MII_LXT971_IER, 0);
-
-	return err;
+		return phy_write(phydev, MII_LXT971_IER, 0);
 }
 
 /*
#2 lore raw

PATCH 2/2 lxt: simplify lxt970_config_init()

In reply to Sergei Shtylyov

This function declares the 'err' local variable for no good reason, get rid of it.

---
 drivers/net/phy/lxt.c |    6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)
drivers/net/phy/lxt.c +1 -5
Index: net-next/drivers/net/phy/lxt.c
===================================================================
@@ -88,11 +88,7 @@ static int lxt970_config_intr(struct phy
 
 static int lxt970_config_init(struct phy_device *phydev)
 {
-	int err;
-
-	err = phy_write(phydev, MII_LXT970_CONFIG, 0);
-
-	return err;
+	return phy_write(phydev, MII_LXT970_CONFIG, 0);
 }