mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-14 00:24:41 -04:00
usb: gadget: Fix crash on calling usb gadget activate/deactivate
Currently the functions usb_gadget_activate and usb_gadget_deactivate are being called with spinlock held. The above functions calls gadget_pullup which invokes pm_runtime_get_sync call, which might sleep. This results in a crash. Fix this by releasing the spinlock and acquiring it after the function call. Change-Id: I17359e3c3227773a8ce269f8db93bc1d56771044 Signed-off-by: Sriharsha Allenki <sallenki@codeaurora.org>
This commit is contained in:
parent
af305c96f5
commit
074b871fb1
1 changed files with 8 additions and 2 deletions
|
|
@ -392,8 +392,11 @@ int usb_function_deactivate(struct usb_function *function)
|
|||
|
||||
spin_lock_irqsave(&cdev->lock, flags);
|
||||
|
||||
if (cdev->deactivations == 0)
|
||||
if (cdev->deactivations == 0) {
|
||||
spin_unlock_irqrestore(&cdev->lock, flags);
|
||||
status = usb_gadget_deactivate(cdev->gadget);
|
||||
spin_lock_irqsave(&cdev->lock, flags);
|
||||
}
|
||||
if (status == 0)
|
||||
cdev->deactivations++;
|
||||
|
||||
|
|
@ -424,8 +427,11 @@ int usb_function_activate(struct usb_function *function)
|
|||
status = -EINVAL;
|
||||
else {
|
||||
cdev->deactivations--;
|
||||
if (cdev->deactivations == 0)
|
||||
if (cdev->deactivations == 0) {
|
||||
spin_unlock_irqrestore(&cdev->lock, flags);
|
||||
status = usb_gadget_activate(cdev->gadget);
|
||||
spin_lock_irqsave(&cdev->lock, flags);
|
||||
}
|
||||
}
|
||||
|
||||
spin_unlock_irqrestore(&cdev->lock, flags);
|
||||
|
|
|
|||
Loading…
Reference in a new issue