| Submitter | Lennert Buytenhek |
|---|---|
| Date | Nov. 18, 2008, 2:33 p.m. |
| Message ID | <20081118143307.GA12255@xi.wantstofly.org> |
| Download | mbox | patch |
| Permalink | /patch/9420/ |
| State | Superseded |
| Headers | show |
Comments
On Tue, Nov 18, 2008 at 03:33:07PM +0100, Lennert Buytenhek wrote: > Commit 46abc02175b3c246dd5141d878f565a8725060c9 ("phylib: give mdio > buses a device tree presence") added a call to device_unregister() in > a situation where the caller did not intend for the device to be > freed yet, but apart from just unregistering the device from the > system, device_unregister() does an additional put_device() that is > intended to free it. > > The right function to use in this situation is device_del(), which > unregisters the device from the system like device_unregister() does, > but without dropping the reference count an additional time. > > Bug report from Bryan Wu <cooloney@kernel.org>. Sorry, ignore this, it seems that you already merged this on friday. -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Patch
diff --git a/drivers/net/phy/mdio_bus.c b/drivers/net/phy/mdio_bus.c index 6671e2d..df06301 100644 --- a/drivers/net/phy/mdio_bus.c +++ b/drivers/net/phy/mdio_bus.c @@ -135,7 +135,7 @@ void mdiobus_unregister(struct mii_bus *bus) BUG_ON(bus->state != MDIOBUS_REGISTERED); bus->state = MDIOBUS_UNREGISTERED; - device_unregister(&bus->dev); + device_del(&bus->dev); for (i = 0; i < PHY_MAX_ADDR; i++) { if (bus->phy_map[i]) device_unregister(&bus->phy_map[i]->dev);
Commit 46abc02175b3c246dd5141d878f565a8725060c9 ("phylib: give mdio buses a device tree presence") added a call to device_unregister() in a situation where the caller did not intend for the device to be freed yet, but apart from just unregistering the device from the system, device_unregister() does an additional put_device() that is intended to free it. The right function to use in this situation is device_del(), which unregisters the device from the system like device_unregister() does, but without dropping the reference count an additional time. Bug report from Bryan Wu <cooloney@kernel.org>. Signed-off-by: Lennert Buytenhek <buytenh@marvell.com> Tested-by: Bryan Wu <cooloney@kernel.org> -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html