USB: android: Handle error conditions if usb_add_config fails

When bind_config() of any function driver fails, we go ahead and do a
usb_gadget_connect() due to which remove_config is called during
next disconnect process and a crash is observed as we delete the
config->list once again.

So if the bind_config of any function driver fails, don't call
usb_gadget_connect(), instead handle the possible error conditions.

CRs-Fixed: 488052
Change-Id: I974e2838ef5c36e586f49ae783e8608150770883
Signed-off-by: Vijayavardhan Vennapusa <vvreddy@codeaurora.org>
diff --git a/drivers/usb/gadget/composite.c b/drivers/usb/gadget/composite.c
index 27d67e3..8c7ff93 100644
--- a/drivers/usb/gadget/composite.c
+++ b/drivers/usb/gadget/composite.c
@@ -824,6 +824,11 @@
 
 	spin_lock_irqsave(&cdev->lock, flags);
 
+	if (WARN_ON(!config->cdev)) {
+		spin_unlock_irqrestore(&cdev->lock, flags);
+		return 0;
+	}
+
 	if (cdev->config == config)
 		reset_config(cdev);