diff options
author | David Bauer <mail@david-bauer.net> | 2019-09-22 19:15:56 +0200 |
---|---|---|
committer | David Bauer <mail@david-bauer.net> | 2019-09-25 22:42:03 +0200 |
commit | e2c084cabc2b2a2fffc36aee3e48874f9862c74a (patch) | |
tree | 33018297cad25c61b313f88d9898b0b501da5e51 | |
parent | c8933ce53365671de98a303c8d94e089ea76754e (diff) | |
download | upstream-e2c084cabc2b2a2fffc36aee3e48874f9862c74a.tar.gz upstream-e2c084cabc2b2a2fffc36aee3e48874f9862c74a.tar.bz2 upstream-e2c084cabc2b2a2fffc36aee3e48874f9862c74a.zip |
ipq40xx: abort ar40xx probe on missing PHYs
The ar40xx driver currently panics in case no QCA807x PHY has been
successfully probed. This happens when the external PHY is still
in reset when probing the ar40xx switch driver.
Note that this patch does not fix the root cause, ar40xx_probe now
simply fails instead of causing a kernel panic due to a nullpointer
dereference.
Signed-off-by: David Bauer <mail@david-bauer.net>
-rw-r--r-- | target/linux/ipq40xx/patches-4.14/706-ar40xx-abort-probe-on-missig-phy.patch | 23 | ||||
-rw-r--r-- | target/linux/ipq40xx/patches-4.19/706-ar40xx-abort-probe-on-missig-phy.patch | 23 |
2 files changed, 46 insertions, 0 deletions
diff --git a/target/linux/ipq40xx/patches-4.14/706-ar40xx-abort-probe-on-missig-phy.patch b/target/linux/ipq40xx/patches-4.14/706-ar40xx-abort-probe-on-missig-phy.patch new file mode 100644 index 0000000000..19474bff0d --- /dev/null +++ b/target/linux/ipq40xx/patches-4.14/706-ar40xx-abort-probe-on-missig-phy.patch @@ -0,0 +1,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; + } diff --git a/target/linux/ipq40xx/patches-4.19/706-ar40xx-abort-probe-on-missig-phy.patch b/target/linux/ipq40xx/patches-4.19/706-ar40xx-abort-probe-on-missig-phy.patch new file mode 100644 index 0000000000..19474bff0d --- /dev/null +++ b/target/linux/ipq40xx/patches-4.19/706-ar40xx-abort-probe-on-missig-phy.patch @@ -0,0 +1,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; + } |