提交 b7a00ecd 编写于 作者: J Jeff Garzik

[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: NJeff Garzik <jeff@garzik.org>
上级 1c7da74c
......@@ -289,9 +289,13 @@ static int fixed_mdio_register_device(int number, int speed, int duplex)
goto probe_fail;
}
device_bind_driver(&phydev->dev);
err = device_bind_driver(&phydev->dev);
up_write(&phydev->dev.bus->subsys.rwsem);
if (err)
goto probe_fail;
return 0;
probe_fail:
......
......@@ -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) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册