netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] net: phy: phy: check return value of bus write
@ 2018-12-26 18:04 Aditya Pakki
  2018-12-26 18:16 ` Heiner Kallweit
  0 siblings, 1 reply; 2+ messages in thread
From: Aditya Pakki @ 2018-12-26 18:04 UTC (permalink / raw)
  To: pakki001
  Cc: kjlu, Andrew Lunn, Florian Fainelli, Heiner Kallweit,
	David S. Miller, netdev, linux-kernel

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@umn.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

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

* Re: [PATCH] net: phy: phy: check return value of bus write
  2018-12-26 18:04 [PATCH] net: phy: phy: check return value of bus write Aditya Pakki
@ 2018-12-26 18:16 ` Heiner Kallweit
  0 siblings, 0 replies; 2+ messages in thread
From: Heiner Kallweit @ 2018-12-26 18:16 UTC (permalink / raw)
  To: Aditya Pakki
  Cc: kjlu, Andrew Lunn, Florian Fainelli, David S. Miller, netdev,
	linux-kernel

On 26.12.2018 19:04, Aditya Pakki wrote:
> 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@umn.edu>
> ---
>  drivers/net/phy/phy.c | 7 +++++--
>  1 file changed, 5 insertions(+), 2 deletions(-)
> 
This file belongs to phylib, not to a specific driver.
"net: phy: phy:" in the subject doesn't make sense, it should be
just "net: phy:". You can see this in the history of the file.

And as commented on another patch of yours:
net-next is closed currently.

Your efforts are appreciated, however you should start with
reading the following:
https://www.kernel.org/doc/Documentation/networking/netdev-FAQ.txt

Heiner

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

end of thread, other threads:[~2018-12-26 18:16 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-12-26 18:04 [PATCH] net: phy: phy: check return value of bus write Aditya Pakki
2018-12-26 18:16 ` Heiner Kallweit

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