Skip to content

Commit

Permalink
drivers/net/phy/mdio_bus.c: call put_device on device_register() failure
Browse files Browse the repository at this point in the history
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.

Signed-off-by: Levente Kurusa <[email protected]>
Cc: Greg Kroah-Hartman <[email protected]>
Cc: Grant Likely <[email protected]>
Cc: David Daney <[email protected]>
Cc: David S. Miller <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
levex authored and torvalds committed Jan 31, 2014
1 parent 54f5968 commit 0c692d0
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions drivers/net/phy/mdio_bus.c
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,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;
}

Expand Down

0 comments on commit 0c692d0

Please sign in to comment.