Merge tag 'usb-6.1-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb
[sfrench/cifs-2.6.git] / drivers / usb / cdns3 / cdnsp-gadget.c
index c67715f6f756dba557c2151a8d7047b7b608690f..f9aa50ff14d42bfcdeed861f2e71d3581b5cf0e4 100644 (file)
@@ -600,11 +600,11 @@ int cdnsp_halt_endpoint(struct cdnsp_device *pdev,
 
        trace_cdnsp_ep_halt(value ? "Set" : "Clear");
 
-       if (value) {
-               ret = cdnsp_cmd_stop_ep(pdev, pep);
-               if (ret)
-                       return ret;
+       ret = cdnsp_cmd_stop_ep(pdev, pep);
+       if (ret)
+               return ret;
 
+       if (value) {
                if (GET_EP_CTX_STATE(pep->out_ctx) == EP_STATE_STOPPED) {
                        cdnsp_queue_halt_endpoint(pdev, pep->idx);
                        cdnsp_ring_cmd_db(pdev);
@@ -613,10 +613,6 @@ int cdnsp_halt_endpoint(struct cdnsp_device *pdev,
 
                pep->ep_state |= EP_HALTED;
        } else {
-               /*
-                * In device mode driver can call reset endpoint command
-                * from any endpoint state.
-                */
                cdnsp_queue_reset_ep(pdev, pep->idx);
                cdnsp_ring_cmd_db(pdev);
                ret = cdnsp_wait_for_cmd_compl(pdev);