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

Commit 5d1c8912 authored by Thinh Nguyen's avatar Thinh Nguyen Committed by Mayank Rana
Browse files

usb: dwc3: gadget: Remove unnecessary checks



Remove 2 unnecessary checks:
1) A request in the started_list must have its trb field set. So
checking for req->trb is unnecessary.

2) An endpoint must have started (and have not ended) for the request to
still be in the started_list. There's no point to check if the endpoint
is started. We had this check because previously the driver didn't
handle the endpoint's started/ended flags for END_TRANSFER command
properly. See commit 9f45581f ("usb: dwc3: gadget: early giveback
if End Transfer already completed").

Change-Id: I5d55f02d25abe06d5601730f1d1d88ee24809d2c
Signed-off-by: default avatarThinh Nguyen <thinhn@synopsys.com>
Signed-off-by: default avatarFelipe Balbi <balbi@kernel.org>
Git-commit: 8411993e79df8e54da67613025d620a8a23a24fe
Git-repo: git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git


Signed-off-by: default avatarMayank Rana <mrana@codeaurora.org>
parent db376566
Loading
Loading
Loading
Loading
+1 −8
Original line number Original line Diff line number Diff line
@@ -1703,9 +1703,6 @@ static int dwc3_gadget_ep_dequeue(struct usb_ep *ep,
			/* wait until it is processed */
			/* wait until it is processed */
			dwc3_stop_active_transfer(dep, true, true);
			dwc3_stop_active_transfer(dep, true, true);


			if (!r->trb)
				goto out0;

			/*
			/*
			 * Remove any started request if the transfer is
			 * Remove any started request if the transfer is
			 * cancelled.
			 * cancelled.
@@ -1713,10 +1710,7 @@ static int dwc3_gadget_ep_dequeue(struct usb_ep *ep,
			list_for_each_entry_safe(r, t, &dep->started_list, list)
			list_for_each_entry_safe(r, t, &dep->started_list, list)
				dwc3_gadget_move_cancelled_request(r);
				dwc3_gadget_move_cancelled_request(r);


			if (dep->flags & DWC3_EP_TRANSFER_STARTED)
			goto out0;
			goto out0;
			else
				goto out1;
		}
		}
		dev_err(dwc->dev, "request %pK was not queued to %s\n",
		dev_err(dwc->dev, "request %pK was not queued to %s\n",
				request, ep->name);
				request, ep->name);
@@ -1724,7 +1718,6 @@ static int dwc3_gadget_ep_dequeue(struct usb_ep *ep,
		goto out0;
		goto out0;
	}
	}


out1:
	dbg_ep_dequeue(dep->number, req);
	dbg_ep_dequeue(dep->number, req);
	dwc3_gadget_giveback(dep, req, -ECONNRESET);
	dwc3_gadget_giveback(dep, req, -ECONNRESET);