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

Commit d558a8bd authored by Rohith Kollalsi's avatar Rohith Kollalsi
Browse files

usb: dwc3: Don't add the request to pending list in case of endxfer



Commit f6967121 ("usb: dwc3: Delete the request from pending
list in case of ep queue failure") deletes request from pending
or started list if ep queue failure is observed. However, this
approach is correct only if request is still in pending list and
endxfer is issued, but if request is moved to started list and any
failure occurs we delete the request in kick transfer, in this case
we are deleting the same request again in ep queue.

Inorder to avoid deleting the same request twice, don't add the
request to pending list if DWC3_EP_END_TRANSFER_PENDING flag is set
at the start of ep queue and return -ESHUTDOWN.

Change-Id: I56be446219ac3dcdd28a62a744189838af634822
Signed-off-by: default avatarRohith Kollalsi <rkollals@codeaurora.org>
parent e3e20132
Loading
Loading
Loading
Loading
+7 −6
Original line number Diff line number Diff line
@@ -1559,7 +1559,6 @@ static void __dwc3_gadget_start_isoc(struct dwc3_ep *dep)
static int __dwc3_gadget_ep_queue(struct dwc3_ep *dep, struct dwc3_request *req)
{
	struct dwc3		*dwc = dep->dwc;
	int ret = 0;

	if (!dep->endpoint.desc || !dwc->pullups_connected) {
		dev_err_ratelimited(dwc->dev, "%s: can't queue to disabled endpoint\n",
@@ -1567,6 +1566,12 @@ static int __dwc3_gadget_ep_queue(struct dwc3_ep *dep, struct dwc3_request *req)
		return -ESHUTDOWN;
	}

	if (dep->flags & DWC3_EP_END_TRANSFER_PENDING) {
		dev_err_ratelimited(dwc->dev, "%s: can't queue while ENDXFER Pending\n",
				dep->name);
		return -ESHUTDOWN;
	}

	if (WARN(req->dep != dep, "request %pK belongs to '%s'\n",
				&req->request, req->dep->name))
		return -EINVAL;
@@ -1606,11 +1611,7 @@ static int __dwc3_gadget_ep_queue(struct dwc3_ep *dep, struct dwc3_request *req)
		}
	}

	ret = __dwc3_gadget_kick_transfer(dep);
	if (ret < 0)
		list_del_init(&req->list);

	return ret;
	return __dwc3_gadget_kick_transfer(dep);
}

static int dwc3_gadget_wakeup(struct usb_gadget *g)