netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Quentin Schulz <quentin.schulz@bootlin.com>
To: davem@davemloft.net, andrew@lunn.ch, f.fainelli@gmail.com
Cc: allan.nielsen@microchip.com, linux-kernel@vger.kernel.org,
	netdev@vger.kernel.org, thomas.petazzoni@bootlin.com,
	alexandre.belloni@bootlin.com,
	Quentin Schulz <quentin.schulz@bootlin.com>
Subject: [PATCH net-next v2 6/6] net: phy: mscc: remove unneeded temporary variable
Date: Thu,  4 Oct 2018 14:47:28 +0200	[thread overview]
Message-ID: <20181004124728.9821-7-quentin.schulz@bootlin.com> (raw)
In-Reply-To: <20181004124728.9821-1-quentin.schulz@bootlin.com>

Here, the rc variable is either used only for the condition right after
the assignment or right before being used as the return value of the
function it's being used in.

So let's remove this unneeded temporary variable whenever possible.

Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: Quentin Schulz <quentin.schulz@bootlin.com>
---
 drivers/net/phy/mscc.c | 12 ++++--------
 1 file changed, 4 insertions(+), 8 deletions(-)

diff --git a/drivers/net/phy/mscc.c b/drivers/net/phy/mscc.c
index 720d8dc81410..9c7159e1ae17 100644
--- a/drivers/net/phy/mscc.c
+++ b/drivers/net/phy/mscc.c
@@ -514,7 +514,7 @@ static void vsc85xx_wol_get(struct phy_device *phydev,
 static int vsc85xx_edge_rate_magic_get(struct phy_device *phydev)
 {
 	u32 vdd, sd;
-	int rc, i, j;
+	int i, j;
 	struct device *dev = &phydev->mdio.dev;
 	struct device_node *of_node = dev->of_node;
 	u8 sd_array_size = ARRAY_SIZE(edge_table[0].slowdown);
@@ -522,12 +522,10 @@ static int vsc85xx_edge_rate_magic_get(struct phy_device *phydev)
 	if (!of_node)
 		return -ENODEV;
 
-	rc = of_property_read_u32(of_node, "vsc8531,vddmac", &vdd);
-	if (rc != 0)
+	if (of_property_read_u32(of_node, "vsc8531,vddmac", &vdd))
 		vdd = MSCC_VDDMAC_3300;
 
-	rc = of_property_read_u32(of_node, "vsc8531,edge-slowdown", &sd);
-	if (rc != 0)
+	if (of_property_read_u32(of_node, "vsc8531,edge-slowdown", &sd))
 		sd = 0;
 
 	for (i = 0; i < ARRAY_SIZE(edge_table); i++)
@@ -781,9 +779,7 @@ static int vsc85xx_config_init(struct phy_device *phydev)
 			return rc;
 	}
 
-	rc = genphy_config_init(phydev);
-
-	return rc;
+	return genphy_config_init(phydev);
 }
 
 static int vsc85xx_ack_interrupt(struct phy_device *phydev)
-- 
2.17.1

      parent reply	other threads:[~2018-10-04 12:47 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-04 12:47 [PATCH net-next v2 0/6] net: phy: mscc: various improvements to Microsemi PHY driver Quentin Schulz
2018-10-04 12:47 ` [PATCH net-next v2 1/6] net: phy: mscc: migrate to phy_select/restore_page functions Quentin Schulz
2018-10-04 15:16   ` Andrew Lunn
2018-10-04 15:57     ` Quentin Schulz
2018-10-04 12:47 ` [PATCH net-next v2 2/6] net: phy: mscc: add ethtool statistics counters Quentin Schulz
2018-10-04 15:22   ` Andrew Lunn
2018-10-04 12:47 ` [PATCH net-next v2 3/6] net: phy: mscc: Add EEE init sequence Quentin Schulz
2018-10-04 12:47 ` [PATCH net-next v2 4/6] net: phy: mscc: remove unneeded parenthesis Quentin Schulz
2018-10-04 12:47 ` [PATCH net-next v2 5/6] net: phy: mscc: shorten `x != 0` condition to `x` Quentin Schulz
2018-10-04 12:47 ` Quentin Schulz [this message]

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=20181004124728.9821-7-quentin.schulz@bootlin.com \
    --to=quentin.schulz@bootlin.com \
    --cc=alexandre.belloni@bootlin.com \
    --cc=allan.nielsen@microchip.com \
    --cc=andrew@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=f.fainelli@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=thomas.petazzoni@bootlin.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).