]> git.baikalelectronics.ru Git - kernel.git/commitdiff
pxa168_eth: fix mdiobus_scan() error check
authorSergei Shtylyov <sergei.shtylyov@cogentembedded.com>
Sat, 30 Apr 2016 20:35:11 +0000 (23:35 +0300)
committerDavid S. Miller <davem@davemloft.net>
Tue, 3 May 2016 19:03:08 +0000 (15:03 -0400)
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>
drivers/net/ethernet/marvell/pxa168_eth.c

index 7ace07dad6a31d4b18ab5aa1e5335c0727cff596..c442f6ad15fff806af5f747e70d085766dd37ae9 100644 (file)
@@ -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;