提交 0e995cd3 编写于 作者: S Sonic Zhang 提交者: David S. Miller

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: NSonic Zhang <sonic.zhang@analog.com>
Signed-off-by: NMike Frysinger <vapier@gentoo.org>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 2bfa0f0c
......@@ -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 @@ static int __devinit bfin_mac_probe(struct platform_device *pdev)
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);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册