diff options
author | Hans de Goede <hdegoede@redhat.com> | 2014-07-25 16:01:21 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2014-08-01 18:58:59 -0400 |
commit | a0ee619f3ce8d8478c0cdd944b6cb24453ab6297 (patch) | |
tree | 05086014d9e8f3d4b08c22531ded0a00c9203dc4 | |
parent | 170625e99485aac578c83fb4aa2bcd9f589570ef (diff) |
xhci: Add missing checks for xhci_alloc_command failure
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r-- | drivers/usb/host/xhci-ring.c | 4 | ||||
-rw-r--r-- | drivers/usb/host/xhci.c | 4 |
2 files changed, 8 insertions, 0 deletions
diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c index 749fc68eb5c1..60fb52ae864b 100644 --- a/drivers/usb/host/xhci-ring.c +++ b/drivers/usb/host/xhci-ring.c | |||
@@ -1118,6 +1118,10 @@ static void xhci_handle_cmd_reset_ep(struct xhci_hcd *xhci, int slot_id, | |||
1118 | if (xhci->quirks & XHCI_RESET_EP_QUIRK) { | 1118 | if (xhci->quirks & XHCI_RESET_EP_QUIRK) { |
1119 | struct xhci_command *command; | 1119 | struct xhci_command *command; |
1120 | command = xhci_alloc_command(xhci, false, false, GFP_ATOMIC); | 1120 | command = xhci_alloc_command(xhci, false, false, GFP_ATOMIC); |
1121 | if (!command) { | ||
1122 | xhci_warn(xhci, "WARN Cannot submit cfg ep: ENOMEM\n"); | ||
1123 | return; | ||
1124 | } | ||
1121 | xhci_dbg_trace(xhci, trace_xhci_dbg_quirks, | 1125 | xhci_dbg_trace(xhci, trace_xhci_dbg_quirks, |
1122 | "Queueing configure endpoint command"); | 1126 | "Queueing configure endpoint command"); |
1123 | xhci_queue_configure_endpoint(xhci, command, | 1127 | xhci_queue_configure_endpoint(xhci, command, |
diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c index a0772d362e70..b6f21175b872 100644 --- a/drivers/usb/host/xhci.c +++ b/drivers/usb/host/xhci.c | |||
@@ -1553,6 +1553,10 @@ int xhci_urb_dequeue(struct usb_hcd *hcd, struct urb *urb, int status) | |||
1553 | */ | 1553 | */ |
1554 | if (!(ep->ep_state & EP_HALT_PENDING)) { | 1554 | if (!(ep->ep_state & EP_HALT_PENDING)) { |
1555 | command = xhci_alloc_command(xhci, false, false, GFP_ATOMIC); | 1555 | command = xhci_alloc_command(xhci, false, false, GFP_ATOMIC); |
1556 | if (!command) { | ||
1557 | ret = -ENOMEM; | ||
1558 | goto done; | ||
1559 | } | ||
1556 | ep->ep_state |= EP_HALT_PENDING; | 1560 | ep->ep_state |= EP_HALT_PENDING; |
1557 | ep->stop_cmds_pending++; | 1561 | ep->stop_cmds_pending++; |
1558 | ep->stop_cmd_timer.expires = jiffies + | 1562 | ep->stop_cmd_timer.expires = jiffies + |