mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-09 13:49:24 -04:00
Merge "usb: gadget: Fix crash on calling usb gadget activate/deactivate"
This commit is contained in:
commit
c63e38f24d
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