From: a17671 Date: Thu, 17 Oct 2019 09:49:51 +0000 (+0800) Subject: usb:configfs:Set udc_name NULL if attach failed X-Git-Tag: MMI-QSB30.62-17~76 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=f5ffaed4cde9ad22a23abf34c16f396588f5e863;p=GitHub%2FMotorolaMobilityLLC%2Fkernel-slsi.git usb:configfs:Set udc_name NULL if attach failed If the probing of UDC controller failed udc_name shall be NULL to avoid double unregistration and the panic It could happen in some corner case Change-Id: I2e6e4168a505b86d8f1b57db53be91acc608ee97 Signed-off-by: a17671 Reviewed-on: https://gerrit.mot.com/1438349 SLTApproved: Slta Waiver SME-Granted: SME Approvals Granted Tested-by: Jira Key Reviewed-by: Xiangpo Zhao Submit-Approved: Jira Key --- diff --git a/drivers/usb/gadget/configfs.c b/drivers/usb/gadget/configfs.c index cd7cdaa3cad0..8dd6ea47a6de 100755 --- a/drivers/usb/gadget/configfs.c +++ b/drivers/usb/gadget/configfs.c @@ -1896,8 +1896,10 @@ static ssize_t secure_store(struct device *pdev, struct device_attribute *attr, pr_err("Failed detaching UDC from gadget %d\n", ret); } else { ret = usb_gadget_probe_driver(&gi->composite.gadget_driver); - if (ret) + if (ret) { + gi->composite.gadget_driver.udc_name = NULL; pr_err("Failed attaching UDC to gadget %d\n", ret); + } } mutex_unlock(&gi->lock);