[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20181226180406.7881-1-pakki001@umn.edu>
Date: Wed, 26 Dec 2018 12:04:06 -0600
From: Aditya Pakki <pakki001@....edu>
To: pakki001@....edu
Cc: kjlu@....edu, Andrew Lunn <andrew@...n.ch>,
Florian Fainelli <f.fainelli@...il.com>,
Heiner Kallweit <hkallweit1@...il.com>,
"David S. Miller" <davem@...emloft.net>, netdev@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: [PATCH] net: phy: phy: check return value of bus write
phy_mii_ioctl() 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@....edu>
---
drivers/net/phy/phy.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c
index 1d73ac3309ce..1fbdaa96b36e 100644
--- a/drivers/net/phy/phy.c
+++ b/drivers/net/phy/phy.c
@@ -397,6 +397,7 @@ int phy_mii_ioctl(struct phy_device *phydev, struct ifreq *ifr, int cmd)
struct mii_ioctl_data *mii_data = if_mii(ifr);
u16 val = mii_data->val_in;
bool change_autoneg = false;
+ int rc;
switch (cmd) {
case SIOCGMIIPHY:
@@ -443,8 +444,10 @@ int phy_mii_ioctl(struct phy_device *phydev, struct ifreq *ifr, int cmd)
}
}
- mdiobus_write(phydev->mdio.bus, mii_data->phy_id,
- mii_data->reg_num, val);
+ rc = mdiobus_write(phydev->mdio.bus, mii_data->phy_id,
+ mii_data->reg_num, val);
+ if (rc)
+ return rc;
if (mii_data->phy_id == phydev->mdio.addr &&
mii_data->reg_num == MII_BMCR &&
--
2.17.1
Powered by blists - more mailing lists