public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] usb: ulpi: call put_device if device_register fails
@ 2015-06-18 17:12 ChengYi He
  2015-06-23 10:57 ` Heikki Krogerus
  0 siblings, 1 reply; 9+ messages in thread
From: ChengYi He @ 2015-06-18 17:12 UTC (permalink / raw)
  To: Heikki Krogerus; +Cc: Felipe Balbi, Greg Kroah-Hartman, linux-usb, linux-kernel

put_device is required to release the last reference to the device.

Signed-off-by: ChengYi He <chengyihetaipei@gmail.com>
---
 drivers/usb/common/ulpi.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/usb/common/ulpi.c b/drivers/usb/common/ulpi.c
index 0e6f968..bd25bdb 100644
--- a/drivers/usb/common/ulpi.c
+++ b/drivers/usb/common/ulpi.c
@@ -184,8 +184,10 @@ static int ulpi_register(struct device *dev, struct ulpi *ulpi)
 	request_module("ulpi:v%04xp%04x", ulpi->id.vendor, ulpi->id.product);
 
 	ret = device_register(&ulpi->dev);
-	if (ret)
+	if (ret) {
+		put_device(&ulpi->dev);
 		return ret;
+	}
 
 	dev_dbg(&ulpi->dev, "registered ULPI PHY: vendor %04x, product %04x\n",
 		ulpi->id.vendor, ulpi->id.product);
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2015-07-23 20:46 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-06-18 17:12 [PATCH] usb: ulpi: call put_device if device_register fails ChengYi He
2015-06-23 10:57 ` Heikki Krogerus
2015-07-22 21:39   ` Greg Kroah-Hartman
2015-07-23  2:04     ` Felipe Balbi
2015-07-23  3:14       ` Greg Kroah-Hartman
2015-07-23  5:02         ` Felipe Balbi
2015-07-23 18:00           ` Greg Kroah-Hartman
2015-07-23 20:08             ` Felipe Balbi
2015-07-23 20:46               ` Greg Kroah-Hartman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox