summaryrefslogtreecommitdiff
path: root/target
diff options
context:
space:
mode:
authorhauke <hauke@3c298f89-4303-0410-b956-a3cf2f4a3e73>2013-10-25 21:12:48 +0000
committerhauke <hauke@3c298f89-4303-0410-b956-a3cf2f4a3e73>2013-10-25 21:12:48 +0000
commit811e48a5b33d0fa55b81c0a15131cc91a81e6090 (patch)
treee68b83bb0b1b1d5d0f39ae269e3afc0866d5ef35 /target
parent3dadeaf6688d97489ca9b56166e42e6603ca5ef7 (diff)
brcm47xx: b44: fix error handling for dummy phy creation
When the mdio bus is unregistered the newly created phy will also be unregistered and freed. Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de> git-svn-id: svn://svn.openwrt.org/openwrt/trunk@38539 3c298f89-4303-0410-b956-a3cf2f4a3e73
Diffstat (limited to 'target')
-rw-r--r--target/linux/brcm47xx/patches-3.10/208-b44-add-dummy-phy-device-if-we-do-not-find-any.patch27
1 files changed, 3 insertions, 24 deletions
diff --git a/target/linux/brcm47xx/patches-3.10/208-b44-add-dummy-phy-device-if-we-do-not-find-any.patch b/target/linux/brcm47xx/patches-3.10/208-b44-add-dummy-phy-device-if-we-do-not-find-any.patch
index fd51a3f61b..db6e5e3eba 100644
--- a/target/linux/brcm47xx/patches-3.10/208-b44-add-dummy-phy-device-if-we-do-not-find-any.patch
+++ b/target/linux/brcm47xx/patches-3.10/208-b44-add-dummy-phy-device-if-we-do-not-find-any.patch
@@ -9,23 +9,21 @@ Subject: [PATCH 9/9] b44: add dummy phy device if we do not find any
--- a/drivers/net/ethernet/broadcom/b44.c
+++ b/drivers/net/ethernet/broadcom/b44.c
-@@ -2222,6 +2222,8 @@ static int b44_register_phy_one(struct b
+@@ -2222,6 +2222,7 @@ static int b44_register_phy_one(struct b
struct ssb_device *sdev = bp->sdev;
struct phy_device *phydev;
int err;
-+ bool dummy_phy = false;
+ struct phy_c45_device_ids c45_ids = {0};
mii_bus = mdiobus_alloc();
if (!mii_bus) {
-@@ -2256,9 +2258,21 @@ static int b44_register_phy_one(struct b
+@@ -2256,9 +2257,20 @@ static int b44_register_phy_one(struct b
phydev = bp->mii_bus->phy_map[bp->phy_addr];
if (!phydev) {
- dev_err(sdev->dev, "could not find PHY at %i\n", bp->phy_addr);
- err = -ENODEV;
- goto err_out_mdiobus_unregister;
-+ dummy_phy = true;
+ dev_info(sdev->dev, "could not find PHY at %i, create dummy one\n",
+ bp->phy_addr);
+
@@ -38,27 +36,8 @@ Subject: [PATCH 9/9] b44: add dummy phy device if we do not find any
+ err = phy_device_register(phydev);
+ if (err) {
+ dev_err(sdev->dev, "failed to register MII bus\n");
-+ goto err_out_phy_free;
++ goto err_out_mdiobus_unregister;
+ }
}
err = phy_connect_direct(bp->dev, phydev, &b44_adjust_link,
-@@ -2266,7 +2280,7 @@ static int b44_register_phy_one(struct b
- if (err < 0) {
- dev_err(sdev->dev, "could not attach PHY at %i\n",
- bp->phy_addr);
-- goto err_out_mdiobus_unregister;
-+ goto err_out_phy_free;
- }
-
- /* mask with MAC supported features */
-@@ -2288,6 +2302,9 @@ static int b44_register_phy_one(struct b
-
- return 0;
-
-+err_out_phy_free:
-+ if (phydev && dummy_phy)
-+ phy_device_free(phydev);
- err_out_mdiobus_unregister:
- mdiobus_unregister(mii_bus);
-