Skip to contentSkip to conversation

+ net-phy-call-put_device-on-device_register-failure.patch added to -mm tree

PATCH [email protected] 1 participant 1 message Dec 16, 2013

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

Subject: + net-phy-call-put_device-on-device_register-failure.patch added to -mm tree
To: [email protected],[email protected],[email protected],[email protected],[email protected]
From: [email protected]
Date: Mon, 16 Dec 2013 15:17:50 -0800

The patch titled
Subject: drivers/net/phy/mdio_bus.c: call put_device on device_register() failure
has been added to the -mm tree. Its filename is
net-phy-call-put_device-on-device_register-failure.patch

This patch should soon appear at
http://ozlabs.org/~akpm/mmots/broken-out/net-phy-call-put_device-on-device_register-failure.patch
and later at
http://ozlabs.org/~akpm/mmotm/broken-out/net-phy-call-put_device-on-device_register-failure.patch

Before you just go and hit "reply", please:
a) Consider who else should be cc'ed
b) Prefer to cc a suitable mailing list as well
c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's

*** Remember to use Documentation/SubmitChecklist when testing your code ***

The -mm tree is included into linux-next and is updated there every 3-4 working days

------------------------------------------------------
From: Levente Kurusa <[email protected]>
Subject: 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.

Cc Greg Kroah-Hartman <[email protected]>
Cc Grant Likely <[email protected]>
Cc David Daney <[email protected]>
Cc David S. Miller <[email protected]>

---

 drivers/net/phy/mdio_bus.c |    1 +
 1 file changed, 1 insertion(+)
drivers/net/phy/mdio_bus.c renamed from drivers/net/phy/mdio_bus.c~net-phy-call-put_device-on-device_register-failure +1 -0
diff -puN drivers/net/phy/mdio_bus.c~net-phy-call-put_device-on-device_register-failure 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;
 	}
 

_

Patches currently in -mm which might be from [email protected] are

kstrtox-remove-redundant-cleanup.patch lib-cmdlinec-declare-exported-symbols-immediately.patch linux-next.patch backlight-lcd-call-put_device-if-device_register-fails.patch net-phy-call-put_device-on-device_register-failure.patch eisa-call-put_device-if-device_register-fails.patch w1-call-put_device-if-device_register-fails.patch