From: Marek Szyprowski Date: Mon, 20 Oct 2014 10:45:33 +0000 (+0200) Subject: usb: dwc2: gadget: fix gadget unregistration in udc_stop() function X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=32805c350bad16e7d4debe55820d2e79dca89fb6;p=GitHub%2FLineageOS%2Fandroid_kernel_motorola_exynos9610.git usb: dwc2: gadget: fix gadget unregistration in udc_stop() function udc_stop() should clear ->driver pointer unconditionally to let the UDC framework to work correctly with both registering/unregistering gadgets and enabling/disabling gadgets by writing to /sys/class/udc/*hsotg/soft_connect interface. Acked-by: Paul Zimmerman Signed-off-by: Marek Szyprowski Signed-off-by: Felipe Balbi --- diff --git a/drivers/usb/dwc2/gadget.c b/drivers/usb/dwc2/gadget.c index 7f25527b10a7..5e548f75686c 100644 --- a/drivers/usb/dwc2/gadget.c +++ b/drivers/usb/dwc2/gadget.c @@ -2937,9 +2937,7 @@ static int s3c_hsotg_udc_stop(struct usb_gadget *gadget, spin_lock_irqsave(&hsotg->lock, flags); - if (!driver) - hsotg->driver = NULL; - + hsotg->driver = NULL; hsotg->gadget.speed = USB_SPEED_UNKNOWN; spin_unlock_irqrestore(&hsotg->lock, flags);