[PATCH] usb: core: endpoint: Fix error path

From: Rahul Ruikar
Date: Sat Oct 02 2010 - 02:50:49 EST


In function usb_create_ep_devs()
call put_device() when device_register() fails.

Signed-off-by: Rahul Ruikar <rahul.ruikar@xxxxxxxxx>
---
drivers/usb/core/endpoint.c | 4 +++-
1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/drivers/usb/core/endpoint.c b/drivers/usb/core/endpoint.c
index 3788e73..cab126d 100644
--- a/drivers/usb/core/endpoint.c
+++ b/drivers/usb/core/endpoint.c
@@ -195,8 +195,10 @@ int usb_create_ep_devs(struct device *parent,
device_enable_async_suspend(&ep_dev->dev);

retval = device_register(&ep_dev->dev);
- if (retval)
+ if (retval) {
+ put_device(&ep_dev->dev);
goto error_register;
+ }

endpoint->ep_dev = ep_dev;
return retval;
--
1.7.2.3

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/