summaryrefslogtreecommitdiffstats
path: root/drivers/net/phy/phy_device.c
diff options
context:
space:
mode:
authorJeff Garzik <jeff@garzik.org>2006-10-01 13:27:46 +0200
committerJeff Garzik <jeff@garzik.org>2006-10-01 13:27:46 +0200
commitb7a00ecd557859c4037b6465fdd6c9a49b1fa649 (patch)
treec3981f739ee2286ecb36054db52b24e690509060 /drivers/net/phy/phy_device.c
parentMerge branch 'master' into upstream (diff)
downloadlinux-b7a00ecd557859c4037b6465fdd6c9a49b1fa649.tar.xz
linux-b7a00ecd557859c4037b6465fdd6c9a49b1fa649.zip
[netdrvr] phy: Fix bugs in error handling
The recent __must_check stuff flagged some error handling bugs. phy/fixed.c: * handle device_bind_driver() failure phy/phy_device.c: * handle device_bind_driver() failure * release rwsem upon failure Signed-off-by: Jeff Garzik <jeff@garzik.org>
Diffstat (limited to 'drivers/net/phy/phy_device.c')
-rw-r--r--drivers/net/phy/phy_device.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c
index ecd3da151e2d..3bbd5e70c209 100644
--- a/drivers/net/phy/phy_device.c
+++ b/drivers/net/phy/phy_device.c
@@ -212,11 +212,13 @@ struct phy_device *phy_attach(struct net_device *dev,
err = d->driver->probe(d);
- if (err < 0)
- return ERR_PTR(err);
+ if (err >= 0)
+ err = device_bind_driver(d);
- device_bind_driver(d);
up_write(&d->bus->subsys.rwsem);
+
+ if (err)
+ return ERR_PTR(err);
}
if (phydev->attached_dev) {