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
1 changed files with 2 additions and 0 deletions
|
|
@ -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…
Add table
Add a link
Reference in a new issue