Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 9d40b50f authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "usb: gadget: Fix crash on calling usb gadget activate/deactivate"

parents 7de36b45 e341cbe0
Loading
Loading
Loading
Loading
+8 −2
Original line number Diff line number Diff line
@@ -363,8 +363,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++;

@@ -395,8 +398,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);