[PATCH] net:phy: Add a return value check on bus write

From: Aditya Pakki
Date: Wed Dec 26 2018 - 12:37:47 EST


xgmiitorgmii_read_status() could fail when writing to the bus via
mdiobus_write(). The fix adds a check and returns an error in case
of failure.

Signed-off-by: Aditya Pakki <pakki001@xxxxxxx>
---
drivers/net/phy/xilinx_gmii2rgmii.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/net/phy/xilinx_gmii2rgmii.c b/drivers/net/phy/xilinx_gmii2rgmii.c
index 74a8782313cf..926879d43373 100644
--- a/drivers/net/phy/xilinx_gmii2rgmii.c
+++ b/drivers/net/phy/xilinx_gmii2rgmii.c
@@ -58,7 +58,9 @@ static int xgmiitorgmii_read_status(struct phy_device *phydev)
else
val |= BMCR_SPEED10;

- mdiobus_write(bus, addr, XILINX_GMII2RGMII_REG, val);
+ err = mdiobus_write(bus, addr, XILINX_GMII2RGMII_REG, val);
+ if (err)
+ return err;

return 0;
}
--
2.17.1