From: Benoit Goby Date: Sat, 19 Oct 2013 00:16:38 +0000 (-0700) Subject: usb: gadget: android: Remove device if probe fails X-Git-Tag: firefly_0821_release~4090^2~492 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=50ce1106dc0d0e9a631795b5c51ae171d62c9910;p=firefly-linux-kernel-4.4.55.git 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 --- 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: