FROMGIT: Revert "usb: dwc3: gadget: Use list_replace_init() before traversing lists"

This reverts commit d25d85061bd856d6be221626605319154f9b5043 as it is
reported to cause problems on many different types of boards.

Reported-by: Thinh Nguyen <Thinh.Nguyen@synopsys.com>
Reported-by: John Stultz <john.stultz@linaro.org>
Cc: Ray Chi <raychi@google.com>
Link: https://lore.kernel.org/r/CANcMJZCEVxVLyFgLwK98hqBEdc0_n4P0x_K6Gih8zNH3ouzbJQ@mail.gmail.com
Fixes: d25d85061bd8 ("usb: dwc3: gadget: Use list_replace_init() before traversing lists")
Cc: stable <stable@vger.kernel.org>
Cc: Felipe Balbi <balbi@kernel.org>
Cc: Wesley Cheng <wcheng@codeaurora.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
(cherry picked from commit 664cc971fb259007e49cc8a3ac43b0787d89443f
 https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git usb-linus)
Bug: 195570448
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Change-Id: I211e8ab42340d18f7f342ff5bc4fb3efe37e1f2e
This commit is contained in:
Greg Kroah-Hartman 2021-08-10 09:10:15 +02:00 committed by Greg Kroah-Hartman
parent 9520a2129f
commit d479d97cb7

View File

@ -1924,13 +1924,9 @@ static void dwc3_gadget_ep_cleanup_cancelled_requests(struct dwc3_ep *dep)
{
struct dwc3_request *req;
struct dwc3_request *tmp;
struct list_head local;
struct dwc3 *dwc = dep->dwc;
restart:
list_replace_init(&dep->cancelled_list, &local);
list_for_each_entry_safe(req, tmp, &local, list) {
list_for_each_entry_safe(req, tmp, &dep->cancelled_list, list) {
dwc3_gadget_ep_skip_trbs(dep, req);
switch (req->status) {
case DWC3_REQUEST_STATUS_DISCONNECTED:
@ -1948,9 +1944,6 @@ static void dwc3_gadget_ep_cleanup_cancelled_requests(struct dwc3_ep *dep)
break;
}
}
if (!list_empty(&dep->cancelled_list))
goto restart;
}
static int dwc3_gadget_ep_dequeue(struct usb_ep *ep,
@ -3218,12 +3211,8 @@ static void dwc3_gadget_ep_cleanup_completed_requests(struct dwc3_ep *dep,
{
struct dwc3_request *req;
struct dwc3_request *tmp;
struct list_head local;
restart:
list_replace_init(&dep->started_list, &local);
list_for_each_entry_safe(req, tmp, &local, list) {
list_for_each_entry_safe(req, tmp, &dep->started_list, list) {
int ret;
ret = dwc3_gadget_ep_cleanup_completed_request(dep, event,
@ -3231,9 +3220,6 @@ static void dwc3_gadget_ep_cleanup_completed_requests(struct dwc3_ep *dep,
if (ret)
break;
}
if (!list_empty(&dep->started_list))
goto restart;
}
static bool dwc3_gadget_ep_should_continue(struct dwc3_ep *dep)