netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] net: phy: Add error checks in the driver
@ 2016-08-19 12:48 Kedareswara rao Appana
  2016-08-19 12:48 ` [PATCH 2/2] net: phy: Fix race conditions " Kedareswara rao Appana
  2016-08-19 13:15 ` [PATCH 1/2] net: phy: Add error checks " Andrew Lunn
  0 siblings, 2 replies; 5+ messages in thread
From: Kedareswara rao Appana @ 2016-08-19 12:48 UTC (permalink / raw)
  To: michal.simek, soren.brinkmann, appanad, f.fainelli, andrew
  Cc: linux-arm-kernel, linux-kernel, netdev

This patch adds the necessary error checks in the driver.

Reported-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: Kedareswara rao Appana <appanad@xilinx.com>
---
 drivers/net/phy/xilinx_gmii2rgmii.c | 14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)

diff --git a/drivers/net/phy/xilinx_gmii2rgmii.c b/drivers/net/phy/xilinx_gmii2rgmii.c
index e7a20ec..7336fd0 100644
--- a/drivers/net/phy/xilinx_gmii2rgmii.c
+++ b/drivers/net/phy/xilinx_gmii2rgmii.c
@@ -39,11 +39,16 @@ struct gmii2rgmii {
 static int xgmiitorgmii_read_status(struct phy_device *phydev)
 {
 	struct gmii2rgmii *priv = phydev->priv;
-	u16 val = 0;
+	int err, val = 0;
 
-	priv->phy_drv->read_status(phydev);
+	err = priv->phy_drv->read_status(phydev);
+	if (err < 0)
+		return err;
 
 	val = mdiobus_read(phydev->mdio.bus, priv->addr, XILINX_GMII2RGMII_REG);
+	if (val < 0)
+		return val;
+
 	val &= XILINX_GMII2RGMII_SPEED_MASK;
 
 	if (phydev->speed == SPEED_1000)
@@ -53,7 +58,10 @@ static int xgmiitorgmii_read_status(struct phy_device *phydev)
 	else
 		val |= BMCR_SPEED10;
 
-	mdiobus_write(phydev->mdio.bus, priv->addr, XILINX_GMII2RGMII_REG, val);
+	err = mdiobus_write(phydev->mdio.bus, priv->addr, XILINX_GMII2RGMII_REG,
+			    val);
+	if (err < 0)
+		return err;
 
 	return 0;
 }
-- 
2.1.2

^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2016-08-19 13:24 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-08-19 12:48 [PATCH 1/2] net: phy: Add error checks in the driver Kedareswara rao Appana
2016-08-19 12:48 ` [PATCH 2/2] net: phy: Fix race conditions " Kedareswara rao Appana
2016-08-19 13:24   ` Andrew Lunn
2016-08-19 13:15 ` [PATCH 1/2] net: phy: Add error checks " Andrew Lunn
2016-08-19 13:18   ` Appana Durga Kedareswara Rao

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).