Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

usb: cdnsp: Fix lack of removing request from pending list.

Patch fixes lack of removing request from ep->pending_list on failure
of the stop endpoint command. Driver even after failing this command
must remove request from ep->pending_list.
Without this fix driver can stuck in cdnsp_gadget_ep_disable function
in loop:
while (!list_empty(&pep->pending_list)) {
preq = next_request(&pep->pending_list);
cdnsp_ep_dequeue(pep, preq);
}

Fixes: 3d82904559f4 ("usb: cdnsp: cdns3 Add main part of Cadence USBSSP DRD Driver")
Signed-off-by: Pawel Laszczak <pawell@cadence.com>
Link: https://lore.kernel.org/r/20210420042813.34917-1-pawell@gli-login.cadence.com
Signed-off-by: Peter Chen <peter.chen@kernel.org>

authored by

Pawel Laszczak and committed by
Peter Chen
3b414d1b 07adc022

+7 -7
+7 -7
drivers/usb/cdns3/cdnsp-gadget.c
··· 422 422 int cdnsp_ep_dequeue(struct cdnsp_ep *pep, struct cdnsp_request *preq) 423 423 { 424 424 struct cdnsp_device *pdev = pep->pdev; 425 - int ret; 425 + int ret_stop = 0; 426 + int ret_rem; 426 427 427 428 trace_cdnsp_request_dequeue(preq); 428 429 429 - if (GET_EP_CTX_STATE(pep->out_ctx) == EP_STATE_RUNNING) { 430 - ret = cdnsp_cmd_stop_ep(pdev, pep); 431 - if (ret) 432 - return ret; 433 - } 430 + if (GET_EP_CTX_STATE(pep->out_ctx) == EP_STATE_RUNNING) 431 + ret_stop = cdnsp_cmd_stop_ep(pdev, pep); 434 432 435 - return cdnsp_remove_request(pdev, preq, pep); 433 + ret_rem = cdnsp_remove_request(pdev, preq, pep); 434 + 435 + return ret_rem ? ret_rem : ret_stop; 436 436 } 437 437 438 438 static void cdnsp_zero_in_ctx(struct cdnsp_device *pdev)