From 50ce1106dc0d0e9a631795b5c51ae171d62c9910 Mon Sep 17 00:00:00 2001 From: Benoit Goby Date: Fri, 18 Oct 2013 17:16:38 -0700 Subject: [PATCH] usb: gadget: android: Remove device if probe fails Make sure the android0 device is removed before we can destroy the class. Change-Id: Id584888c407beb80a1df4990f73fe31ccb9d4767 Signed-off-by: Benoit Goby --- drivers/usb/gadget/android.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/usb/gadget/android.c b/drivers/usb/gadget/android.c index d0ec54b810c1..04cbeb134814 100644 --- a/drivers/usb/gadget/android.c +++ b/drivers/usb/gadget/android.c @@ -1490,7 +1490,7 @@ static int __init init(void) err = usb_composite_probe(&android_usb_driver); if (err) { pr_err("%s: failed to probe driver %d", __func__, err); - goto err_create; + goto err_probe; } /* HACK: exchange composite's setup with ours */ @@ -1499,6 +1499,8 @@ static int __init init(void) return 0; +err_probe: + device_destroy(android_class, dev->dev->devt); err_create: kfree(dev); err_dev: -- 2.34.1