Title: [6055] trunk/drivers/net/bfin_mac.c: Bug [#4850], add sanity check and error message when the platform device bfin_mii_bus are not defined in board file
Revision
6055
Author
gyang
Date
2009-02-04 00:53:44 -0600 (Wed, 04 Feb 2009)

Log Message

Bug [#4850], add sanity check and error message when the platform device bfin_mii_bus are not defined in board file

Modified Paths

Diff

Modified: trunk/drivers/net/bfin_mac.c (6054 => 6055)


--- trunk/drivers/net/bfin_mac.c	2009-02-04 03:49:14 UTC (rev 6054)
+++ trunk/drivers/net/bfin_mac.c	2009-02-04 06:53:44 UTC (rev 6055)
@@ -1022,8 +1022,8 @@
 {
 	struct net_device *ndev;
 	struct bfin_mac_local *lp;
+	struct platform_device *pd;
 	int rc;
-	struct platform_device *pd = pdev->dev.platform_data;
 
 	ndev = alloc_etherdev(sizeof(struct bfin_mac_local));
 	if (!ndev) {
@@ -1063,8 +1063,13 @@
 
 	setup_mac_addr(ndev->dev_addr);
 
-	/* MDIO bus initial */
-	lp->mii_bus = platform_get_drvdata(pd);;
+	if (!pdev->dev.platform_data) {
+		dev_err(&pdev->dev, "Cannot get platform device bfin_mii_bus!\n");
+		rc = -ENODEV;
+		goto out_err_probe_mac;
+	}
+	pd = pdev->dev.platform_data;
+	lp->mii_bus = platform_get_drvdata(pd);
 	lp->mii_bus->priv = ndev;
 
 	rc = mii_probe(ndev);
_______________________________________________
Linux-kernel-commits mailing list
[email protected]
http://blackfin.uclinux.org/mailman/listinfo/linux-kernel-commits

Reply via email to