diff options
author | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2012-10-25 16:34:25 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2012-10-25 16:34:25 -0400 |
commit | 1d63f24697b1259921f08ad3684502216c1cd793 (patch) | |
tree | 9fcaa8bff51ab0d1cbcb70a7d9ea182035cdccec | |
parent | 8daf8b6086f9d575200cd0aa3797e26137255609 (diff) | |
parent | df0379065b3850cd42447b59578a2f9362047487 (diff) |
Merge tag 'for-usb-linus-2012-10-25' of git://git.kernel.org/pub/scm/linux/kernel/git/sarah/xhci into usb-linus
xHCI trivial fixes for 3.7
Hi Greg,
Here's four trivial xHCI bug fixes for 3.7. They clean up some issues found
while running Coverity across the xHCI driver. One is marked for stable.
Sarah Sharp
-rw-r--r-- | drivers/usb/host/xhci-dbg.c | 2 | ||||
-rw-r--r-- | drivers/usb/host/xhci-ring.c | 11 | ||||
-rw-r--r-- | drivers/usb/host/xhci.c | 4 |
3 files changed, 13 insertions, 4 deletions
diff --git a/drivers/usb/host/xhci-dbg.c b/drivers/usb/host/xhci-dbg.c index 4b436f5a4171..5f3a7c74aa8d 100644 --- a/drivers/usb/host/xhci-dbg.c +++ b/drivers/usb/host/xhci-dbg.c | |||
@@ -544,7 +544,6 @@ void xhci_dbg_ctx(struct xhci_hcd *xhci, | |||
544 | int i; | 544 | int i; |
545 | /* Fields are 32 bits wide, DMA addresses are in bytes */ | 545 | /* Fields are 32 bits wide, DMA addresses are in bytes */ |
546 | int field_size = 32 / 8; | 546 | int field_size = 32 / 8; |
547 | struct xhci_slot_ctx *slot_ctx; | ||
548 | dma_addr_t dma = ctx->dma; | 547 | dma_addr_t dma = ctx->dma; |
549 | int csz = HCC_64BYTE_CONTEXT(xhci->hcc_params); | 548 | int csz = HCC_64BYTE_CONTEXT(xhci->hcc_params); |
550 | 549 | ||
@@ -570,7 +569,6 @@ void xhci_dbg_ctx(struct xhci_hcd *xhci, | |||
570 | dbg_rsvd64(xhci, (u64 *)ctrl_ctx, dma); | 569 | dbg_rsvd64(xhci, (u64 *)ctrl_ctx, dma); |
571 | } | 570 | } |
572 | 571 | ||
573 | slot_ctx = xhci_get_slot_ctx(xhci, ctx); | ||
574 | xhci_dbg_slot_ctx(xhci, ctx); | 572 | xhci_dbg_slot_ctx(xhci, ctx); |
575 | xhci_dbg_ep_ctx(xhci, ctx, last_ep); | 573 | xhci_dbg_ep_ctx(xhci, ctx, last_ep); |
576 | } | 574 | } |
diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c index c6ebb176dc4f..4e1a8946b8d1 100644 --- a/drivers/usb/host/xhci-ring.c +++ b/drivers/usb/host/xhci-ring.c | |||
@@ -1228,6 +1228,17 @@ static void xhci_cmd_to_noop(struct xhci_hcd *xhci, struct xhci_cd *cur_cd) | |||
1228 | cur_seg = find_trb_seg(xhci->cmd_ring->first_seg, | 1228 | cur_seg = find_trb_seg(xhci->cmd_ring->first_seg, |
1229 | xhci->cmd_ring->dequeue, &cycle_state); | 1229 | xhci->cmd_ring->dequeue, &cycle_state); |
1230 | 1230 | ||
1231 | if (!cur_seg) { | ||
1232 | xhci_warn(xhci, "Command ring mismatch, dequeue = %p %llx (dma)\n", | ||
1233 | xhci->cmd_ring->dequeue, | ||
1234 | (unsigned long long) | ||
1235 | xhci_trb_virt_to_dma(xhci->cmd_ring->deq_seg, | ||
1236 | xhci->cmd_ring->dequeue)); | ||
1237 | xhci_debug_ring(xhci, xhci->cmd_ring); | ||
1238 | xhci_dbg_ring_ptrs(xhci, xhci->cmd_ring); | ||
1239 | return; | ||
1240 | } | ||
1241 | |||
1231 | /* find the command trb matched by cd from command ring */ | 1242 | /* find the command trb matched by cd from command ring */ |
1232 | for (cmd_trb = xhci->cmd_ring->dequeue; | 1243 | for (cmd_trb = xhci->cmd_ring->dequeue; |
1233 | cmd_trb != xhci->cmd_ring->enqueue; | 1244 | cmd_trb != xhci->cmd_ring->enqueue; |
diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c index 9ec939646b42..c9e419f29b74 100644 --- a/drivers/usb/host/xhci.c +++ b/drivers/usb/host/xhci.c | |||
@@ -1627,7 +1627,6 @@ int xhci_add_endpoint(struct usb_hcd *hcd, struct usb_device *udev, | |||
1627 | struct xhci_hcd *xhci; | 1627 | struct xhci_hcd *xhci; |
1628 | struct xhci_container_ctx *in_ctx, *out_ctx; | 1628 | struct xhci_container_ctx *in_ctx, *out_ctx; |
1629 | unsigned int ep_index; | 1629 | unsigned int ep_index; |
1630 | struct xhci_ep_ctx *ep_ctx; | ||
1631 | struct xhci_slot_ctx *slot_ctx; | 1630 | struct xhci_slot_ctx *slot_ctx; |
1632 | struct xhci_input_control_ctx *ctrl_ctx; | 1631 | struct xhci_input_control_ctx *ctrl_ctx; |
1633 | u32 added_ctxs; | 1632 | u32 added_ctxs; |
@@ -1663,7 +1662,6 @@ int xhci_add_endpoint(struct usb_hcd *hcd, struct usb_device *udev, | |||
1663 | out_ctx = virt_dev->out_ctx; | 1662 | out_ctx = virt_dev->out_ctx; |
1664 | ctrl_ctx = xhci_get_input_control_ctx(xhci, in_ctx); | 1663 | ctrl_ctx = xhci_get_input_control_ctx(xhci, in_ctx); |
1665 | ep_index = xhci_get_endpoint_index(&ep->desc); | 1664 | ep_index = xhci_get_endpoint_index(&ep->desc); |
1666 | ep_ctx = xhci_get_ep_ctx(xhci, out_ctx, ep_index); | ||
1667 | 1665 | ||
1668 | /* If this endpoint is already in use, and the upper layers are trying | 1666 | /* If this endpoint is already in use, and the upper layers are trying |
1669 | * to add it again without dropping it, reject the addition. | 1667 | * to add it again without dropping it, reject the addition. |
@@ -1817,6 +1815,8 @@ static int xhci_evaluate_context_result(struct xhci_hcd *xhci, | |||
1817 | case COMP_EBADSLT: | 1815 | case COMP_EBADSLT: |
1818 | dev_warn(&udev->dev, "WARN: slot not enabled for" | 1816 | dev_warn(&udev->dev, "WARN: slot not enabled for" |
1819 | "evaluate context command.\n"); | 1817 | "evaluate context command.\n"); |
1818 | ret = -EINVAL; | ||
1819 | break; | ||
1820 | case COMP_CTX_STATE: | 1820 | case COMP_CTX_STATE: |
1821 | dev_warn(&udev->dev, "WARN: invalid context state for " | 1821 | dev_warn(&udev->dev, "WARN: invalid context state for " |
1822 | "evaluate context command.\n"); | 1822 | "evaluate context command.\n"); |