aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux/ipq40xx/patches-4.14/706-ar40xx-abort-probe-on-missig-phy.patch
blob: 19474bff0d0d669197c6bb6a19494c02f9e6ca28 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
--- a/drivers/net/phy/ar40xx.c
+++ b/drivers/net/phy/ar40xx.c
@@ -2021,6 +2021,12 @@ static int ar40xx_probe(struct platform_
 	/* register switch */
 	swdev = &priv->dev;
 
+	if (priv->mii_bus == NULL) {
+		dev_err(&pdev->dev, "Probe failed - Missing PHYs!\n");
+		ret = -ENODEV;
+		goto err_missing_phy;
+	}
+
 	swdev->alias = dev_name(&priv->mii_bus->dev);
 
 	swdev->cpu_port = AR40XX_PORT_CPU;
@@ -2052,6 +2058,7 @@ err_unregister_switch:
 	unregister_switch(&priv->dev);
 err_unregister_phy:
 	phy_driver_unregister(&ar40xx_phy_driver);
+err_missing_phy:
 	platform_set_drvdata(pdev, NULL);
 	return ret;
 }