Skip to content

Commit

Permalink
net/cadence/macb: fix invalid 0 return if no phy is discovered on mii…
Browse files Browse the repository at this point in the history
… init

Replace misleading -1 (-EPERM) by a more appropriate return code (-ENXIO)
in macb_mii_probe function.
Save macb_mii_probe return before branching to err_out_unregister to avoid
erronous 0 return.

Signed-off-by: Boris BREZILLON <b.brezillon@overkiz.com>
Acked-by: Nicolas Ferre <nicolas.ferre@atmel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Boris BREZILLON authored and David S. Miller committed Aug 29, 2013
1 parent fd09480 commit 7daa78e
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions drivers/net/ethernet/cadence/macb.c
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ static int macb_mii_probe(struct net_device *dev)
phydev = phy_find_first(bp->mii_bus);
if (!phydev) {
netdev_err(dev, "no PHY found\n");
return -1;
return -ENXIO;
}

pdata = dev_get_platdata(&bp->pdev->dev);
Expand Down Expand Up @@ -379,9 +379,9 @@ int macb_mii_init(struct macb *bp)
if (err)
goto err_out_free_mdio_irq;

if (macb_mii_probe(bp->dev) != 0) {
err = macb_mii_probe(bp->dev);
if (err)
goto err_out_unregister_bus;
}

return 0;

Expand Down

0 comments on commit 7daa78e

Please sign in to comment.