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 <[email protected]> Signed-off-by: Sergei Shtylyov <[email protected]> --- The patch is against DaveM's 'net.git' repo. drivers/net/ethernet/marvell/pxa168_eth.c | 2 ++ 1 file changed, 2 insertions(+) Index: net/drivers/net/ethernet/marvell/pxa168_eth.c =================================================================== --- net.orig/drivers/net/ethernet/marvell/pxa168_eth.c +++ net/drivers/net/ethernet/marvell/pxa168_eth.c @@ -979,6 +979,8 @@ static int pxa168_init_phy(struct net_de 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;
