usb: dwc3: gadget: Fix double add due to cleanup_cancelled_request
Commit 6a247993218c ("usb: dwc3: gadget: Properly handle failed kick_transfer") introduces a piece of code where if gadget_ep_cmd fails in kick_transfer, it calls stop_active_transfer for that ep & move the request from started_list to cancelled_list. Finally it checks for DWC3_EP_END_TRANSFER_PENDING flag, if not set then moves ahead and calls dwc3_gadget_cleanup_cancelled_request as part of which gadget giveback for the request is called. This will ultimately mean ep_queue failure as ep_queue returns the status of kick_transfer. Now from the function driver perspective, when ep_queue fails it tries to add the request back to the pool from which the request was queued. But,since we did a cleanup_cancelled_request the completion handler of the function driver is also called which tries to add the same request back to the pool, resulting in a double add scenario. Fix this by returning 0 from ep_queue rather then returning the status of kick_transfer. For a function driver it would mean ep_queue success and will not add the request back to read pool and since we already are giving back the request as part of cleanup_cancelled_requests, the request will be added back to the pool and avoid the double add scenario. Change-Id: I82bc21c34a795820998483c4a88e1891495a6906 Signed-off-by:Udipto Goswami <ugoswami@codeaurora.org> Signed-off-by:
Pratham Pratap <prathampratap@codeaurora.org>
Loading
Please register or sign in to comment