diff options
author | Sonic Zhang <sonic.zhang@analog.com> | 2010-05-10 07:39:14 +0200 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2010-05-18 02:21:01 +0200 |
commit | 0e995cd3d3c78377a0bc7d38236fc50e5438fabb (patch) | |
tree | 5525fe8194257fb9a2d47d7b8d3bf4b4e80131c6 /drivers/net/bfin_mac.c | |
parent | netdev: bfin_mac: handle timeouts with the MDIO registers gracefully (diff) | |
download | linux-0e995cd3d3c78377a0bc7d38236fc50e5438fabb.tar.xz linux-0e995cd3d3c78377a0bc7d38236fc50e5438fabb.zip |
netdev: bfin_mac: check for mii_bus platform data
If the platform data for the mii_bus is missing, gracefully error out
rather than deference NULL pointers.
Signed-off-by: Sonic Zhang <sonic.zhang@analog.com>
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/bfin_mac.c')
-rw-r--r-- | drivers/net/bfin_mac.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/drivers/net/bfin_mac.c b/drivers/net/bfin_mac.c index 2538eaa891ad..39a54bad397f 100644 --- a/drivers/net/bfin_mac.c +++ b/drivers/net/bfin_mac.c @@ -1466,6 +1466,11 @@ static int __devinit bfin_mac_probe(struct platform_device *pdev) } pd = pdev->dev.platform_data; lp->mii_bus = platform_get_drvdata(pd); + if (!lp->mii_bus) { + dev_err(&pdev->dev, "Cannot get mii_bus!\n"); + rc = -ENODEV; + goto out_err_mii_bus_probe; + } lp->mii_bus->priv = ndev; rc = mii_probe(ndev); @@ -1511,6 +1516,7 @@ out_err_request_irq: out_err_mii_probe: mdiobus_unregister(lp->mii_bus); mdiobus_free(lp->mii_bus); +out_err_mii_bus_probe: peripheral_free_list(pin_req); out_err_probe_mac: platform_set_drvdata(pdev, NULL); |