Skip to content

Commit 0c692d0

Browse files
levextorvalds
authored andcommittedJan 31, 2014
drivers/net/phy/mdio_bus.c: call put_device on device_register() failure
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]>
1 parent 54f5968 commit 0c692d0

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed
 

‎drivers/net/phy/mdio_bus.c

+1
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,7 @@ int mdiobus_register(struct mii_bus *bus)
150150
err = device_register(&bus->dev);
151151
if (err) {
152152
pr_err("mii_bus %s failed to register\n", bus->id);
153+
put_device(&bus->dev);
153154
return -EINVAL;
154155
}
155156

0 commit comments

Comments
 (0)