netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next] net: phy: mscc: add missing check on a phy_write return value
@ 2020-03-19 12:48 Antoine Tenart
  2020-03-20  4:03 ` David Miller
  0 siblings, 1 reply; 2+ messages in thread
From: Antoine Tenart @ 2020-03-19 12:48 UTC (permalink / raw)
  To: davem, andrew, f.fainelli, hkallweit1
  Cc: Antoine Tenart, netdev, linux-kernel

Commit a5afc1678044 ("net: phy: mscc: add support for VSC8584 PHY")
introduced a call to 'phy_write' storing its return value to a variable
called 'ret'. But 'ret' never was checked for a possible error being
returned, and hence was not used at all. Fix this by checking the return
value and exiting the function if an error was returned.

As this does not fix a known bug, this commit is mostly cosmetic and not
sent as a fix.

Signed-off-by: Antoine Tenart <antoine.tenart@bootlin.com>
---
 drivers/net/phy/mscc/mscc_main.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/net/phy/mscc/mscc_main.c b/drivers/net/phy/mscc/mscc_main.c
index 2f6229a70ec1..bc6beec8aff0 100644
--- a/drivers/net/phy/mscc/mscc_main.c
+++ b/drivers/net/phy/mscc/mscc_main.c
@@ -1411,6 +1411,8 @@ static int vsc8584_config_init(struct phy_device *phydev)
 	val |= (MEDIA_OP_MODE_COPPER << MEDIA_OP_MODE_POS) |
 	       (VSC8584_MAC_IF_SELECTION_SGMII << VSC8584_MAC_IF_SELECTION_POS);
 	ret = phy_write(phydev, MSCC_PHY_EXT_PHY_CNTL_1, val);
+	if (ret)
+		return ret;
 
 	ret = genphy_soft_reset(phydev);
 	if (ret)
-- 
2.25.1


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

* Re: [PATCH net-next] net: phy: mscc: add missing check on a phy_write return value
  2020-03-19 12:48 [PATCH net-next] net: phy: mscc: add missing check on a phy_write return value Antoine Tenart
@ 2020-03-20  4:03 ` David Miller
  0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2020-03-20  4:03 UTC (permalink / raw)
  To: antoine.tenart; +Cc: andrew, f.fainelli, hkallweit1, netdev, linux-kernel

From: Antoine Tenart <antoine.tenart@bootlin.com>
Date: Thu, 19 Mar 2020 13:48:19 +0100

> Commit a5afc1678044 ("net: phy: mscc: add support for VSC8584 PHY")
> introduced a call to 'phy_write' storing its return value to a variable
> called 'ret'. But 'ret' never was checked for a possible error being
> returned, and hence was not used at all. Fix this by checking the return
> value and exiting the function if an error was returned.
> 
> As this does not fix a known bug, this commit is mostly cosmetic and not
> sent as a fix.
> 
> Signed-off-by: Antoine Tenart <antoine.tenart@bootlin.com>

Applied, thanks.

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

end of thread, other threads:[~2020-03-20  4:03 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-19 12:48 [PATCH net-next] net: phy: mscc: add missing check on a phy_write return value Antoine Tenart
2020-03-20  4:03 ` David Miller

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