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

Commit c00dd4a6 authored by Gregory Herrero's avatar Gregory Herrero Committed by Felipe Balbi
Browse files

usb: dwc2: gadget: fix clear halt feature handling



When clearing HALT on an endpoint, req->complete of in progress
requests must be called with locks off. New request should only be
started if there is not already a pending request on the endpoint.

Tested-by: default avatarRobert Baldyga <r.baldyga@samsung.com>
Acked-by: default avatarJohn Youn <johnyoun@synopsys.com>
Signed-off-by: default avatarGregory Herrero <gregory.herrero@intel.com>
Signed-off-by: default avatarFelipe Balbi <balbi@ti.com>
parent b46146d5
Loading
Loading
Loading
Loading
+13 −7
Original line number Original line Diff line number Diff line
@@ -1007,11 +1007,16 @@ static int s3c_hsotg_process_req_feature(struct dwc2_hsotg *hsotg,
					hs_req = ep->req;
					hs_req = ep->req;
					ep->req = NULL;
					ep->req = NULL;
					list_del_init(&hs_req->queue);
					list_del_init(&hs_req->queue);
					usb_gadget_giveback_request(&ep->ep,
					if (hs_req->req.complete) {
								    &hs_req->req);
						spin_unlock(&hsotg->lock);
						usb_gadget_giveback_request(
							&ep->ep, &hs_req->req);
						spin_lock(&hsotg->lock);
					}
				}
				}


				/* If we have pending request, then start it */
				/* If we have pending request, then start it */
				if (!ep->req) {
					restart = !list_empty(&ep->queue);
					restart = !list_empty(&ep->queue);
					if (restart) {
					if (restart) {
						hs_req = get_ep_head(ep);
						hs_req = get_ep_head(ep);
@@ -1019,6 +1024,7 @@ static int s3c_hsotg_process_req_feature(struct dwc2_hsotg *hsotg,
								hs_req, false);
								hs_req, false);
					}
					}
				}
				}
			}


			break;
			break;