mirror of
https://github.com/torvalds/linux.git
synced 2024-11-30 08:01:59 +00:00
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>
This commit is contained in:
parent
3df8f4c6e9
commit
6dd7454258
@ -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;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user