usb: gadget: android: Remove device if probe fails
authorBenoit Goby <benoit@android.com>
Sat, 19 Oct 2013 00:16:38 +0000 (17:16 -0700)
committerJohn Stultz <john.stultz@linaro.org>
Mon, 21 Oct 2013 16:51:30 +0000 (09:51 -0700)
Make sure the android0 device is removed before we can destroy
the class.

Change-Id: Id584888c407beb80a1df4990f73fe31ccb9d4767
Signed-off-by: Benoit Goby <benoit@android.com>
Signed-off-by: John Stultz <john.stultz@linaro.org>
drivers/usb/gadget/android.c

index d0ec54b810c103dfa6ebc34e139233b00b615162..04cbeb134814ae925beead5f9387bb8350dd4b38 100644 (file)
@@ -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: