|
@@ -420,14 +420,25 @@ static int xhci_stop_device(struct xhci_hcd *xhci, int slot_id, int suspend)
|
|
|
GFP_NOWAIT);
|
|
|
if (!command) {
|
|
|
spin_unlock_irqrestore(&xhci->lock, flags);
|
|
|
- xhci_free_command(xhci, cmd);
|
|
|
- return -ENOMEM;
|
|
|
+ ret = -ENOMEM;
|
|
|
+ goto cmd_cleanup;
|
|
|
+ }
|
|
|
+
|
|
|
+ ret = xhci_queue_stop_endpoint(xhci, command, slot_id,
|
|
|
+ i, suspend);
|
|
|
+ if (ret) {
|
|
|
+ spin_unlock_irqrestore(&xhci->lock, flags);
|
|
|
+ xhci_free_command(xhci, command);
|
|
|
+ goto cmd_cleanup;
|
|
|
}
|
|
|
- xhci_queue_stop_endpoint(xhci, command, slot_id, i,
|
|
|
- suspend);
|
|
|
}
|
|
|
}
|
|
|
- xhci_queue_stop_endpoint(xhci, cmd, slot_id, 0, suspend);
|
|
|
+ ret = xhci_queue_stop_endpoint(xhci, cmd, slot_id, 0, suspend);
|
|
|
+ if (ret) {
|
|
|
+ spin_unlock_irqrestore(&xhci->lock, flags);
|
|
|
+ goto cmd_cleanup;
|
|
|
+ }
|
|
|
+
|
|
|
xhci_ring_cmd_db(xhci);
|
|
|
spin_unlock_irqrestore(&xhci->lock, flags);
|
|
|
|
|
@@ -439,6 +450,8 @@ static int xhci_stop_device(struct xhci_hcd *xhci, int slot_id, int suspend)
|
|
|
xhci_warn(xhci, "Timeout while waiting for stop endpoint command\n");
|
|
|
ret = -ETIME;
|
|
|
}
|
|
|
+
|
|
|
+cmd_cleanup:
|
|
|
xhci_free_command(xhci, cmd);
|
|
|
return ret;
|
|
|
}
|