Browse Source

pxa168_eth: fix mdiobus_scan() error check

Since mdiobus_scan() returns either an error code or NULL on error, the
driver should check  for both,  not only for NULL, otherwise a crash is
imminent...

Reported-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Sergei Shtylyov 9 years ago
parent
commit
6dd7454258
1 changed files with 2 additions and 0 deletions
  1. 2 0
      drivers/net/ethernet/marvell/pxa168_eth.c

+ 2 - 0
drivers/net/ethernet/marvell/pxa168_eth.c

@@ -979,6 +979,8 @@ static int pxa168_init_phy(struct net_device *dev)
 		return 0;
 
 	pep->phy = mdiobus_scan(pep->smi_bus, pep->phy_addr);
+	if (IS_ERR(pep->phy))
+		return PTR_ERR(pep->phy);
 	if (!pep->phy)
 		return -ENODEV;