netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net] net: phy: Add missing driver check in phy_aneg_done()
@ 2017-02-23 22:22 Florian Fainelli
  2017-02-24 16:20 ` David Miller
  0 siblings, 1 reply; 2+ messages in thread
From: Florian Fainelli @ 2017-02-23 22:22 UTC (permalink / raw)
  To: netdev; +Cc: davem, andrew, dan.carpenter, rmk+kernel, Florian Fainelli

Dan's static checker caught a potential code path in phy_state_machine() where
we were not checking phydev->drv which is in phy_aneg_done().

Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Fixes: 25149ef9d25c ("net: phy: Check phydev->drv")
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
---
 drivers/net/phy/phy.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c
index d6f7838455dd..1be69d8bc909 100644
--- a/drivers/net/phy/phy.c
+++ b/drivers/net/phy/phy.c
@@ -146,7 +146,7 @@ static int phy_config_interrupt(struct phy_device *phydev, u32 interrupts)
  */
 int phy_aneg_done(struct phy_device *phydev)
 {
-	if (phydev->drv->aneg_done)
+	if (phydev->drv && phydev->drv->aneg_done)
 		return phydev->drv->aneg_done(phydev);
 
 	return genphy_aneg_done(phydev);
-- 
2.9.3

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

* Re: [PATCH net] net: phy: Add missing driver check in phy_aneg_done()
  2017-02-23 22:22 [PATCH net] net: phy: Add missing driver check in phy_aneg_done() Florian Fainelli
@ 2017-02-24 16:20 ` David Miller
  0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2017-02-24 16:20 UTC (permalink / raw)
  To: f.fainelli; +Cc: netdev, andrew, dan.carpenter, rmk+kernel

From: Florian Fainelli <f.fainelli@gmail.com>
Date: Thu, 23 Feb 2017 14:22:19 -0800

> Dan's static checker caught a potential code path in phy_state_machine() where
> we were not checking phydev->drv which is in phy_aneg_done().
> 
> Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
> Fixes: 25149ef9d25c ("net: phy: Check phydev->drv")
> Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>

Applied.

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

end of thread, other threads:[~2017-02-24 16:22 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-02-23 22:22 [PATCH net] net: phy: Add missing driver check in phy_aneg_done() Florian Fainelli
2017-02-24 16:20 ` 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).