Messages in this thread Patch in this message | | | From | Levente Kurusa <> | Subject | [PATCH 1/4] net: phy: call put_device on device_register() failure | Date | Fri, 13 Dec 2013 20:22:34 +0100 |
| |
It is required to call put_device() if device_register() fails, so that we give up the last reference to the device. Calling put_device allows for mdiobus_release to be executed, kfreeing the bus.
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Cc: Grant Likely <grant.likely@secretlab.ca> Signed-off-by: Levente Kurusa <levex@linux.com> --- drivers/net/phy/mdio_bus.c | 1 + 1 file changed, 1 insertion(+)
diff --git a/drivers/net/phy/mdio_bus.c b/drivers/net/phy/mdio_bus.c index 5617876..b071af7 100644 --- a/drivers/net/phy/mdio_bus.c +++ b/drivers/net/phy/mdio_bus.c @@ -154,6 +154,7 @@ int mdiobus_register(struct mii_bus *bus) err = device_register(&bus->dev); if (err) { pr_err("mii_bus %s failed to register\n", bus->id); + put_device(&bus->dev); return -EINVAL; } -- 1.8.3.1
| |