| From d5501d5c29a2e684640507cfee428178d6fd82ca Mon Sep 17 00:00:00 2001 |
| From: "Ben Dooks (Codethink)" <ben.dooks@codethink.co.uk> |
| Date: Fri, 25 Oct 2019 17:30:29 +0300 |
| Subject: usb: xhci: fix __le32/__le64 accessors in debugfs code |
| |
| From: Ben Dooks (Codethink) <ben.dooks@codethink.co.uk> |
| |
| commit d5501d5c29a2e684640507cfee428178d6fd82ca upstream. |
| |
| It looks like some of the xhci debug code is passing u32 to functions |
| directly from __le32/__le64 fields. |
| Fix this by using le{32,64}_to_cpu() on these to fix the following |
| sparse warnings; |
| |
| xhci-debugfs.c:205:62: warning: incorrect type in argument 1 (different base types) |
| xhci-debugfs.c:205:62: expected unsigned int [usertype] field0 |
| xhci-debugfs.c:205:62: got restricted __le32 |
| xhci-debugfs.c:206:62: warning: incorrect type in argument 2 (different base types) |
| xhci-debugfs.c:206:62: expected unsigned int [usertype] field1 |
| xhci-debugfs.c:206:62: got restricted __le32 |
| ... |
| |
| [Trim down commit message, sparse warnings were similar -Mathias] |
| Cc: <stable@vger.kernel.org> # 4.15+ |
| Signed-off-by: Ben Dooks <ben.dooks@codethink.co.uk> |
| Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com> |
| Link: https://lore.kernel.org/r/1572013829-14044-4-git-send-email-mathias.nyman@linux.intel.com |
| Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> |
| |
| --- |
| drivers/usb/host/xhci-debugfs.c | 24 ++++++++++++------------ |
| 1 file changed, 12 insertions(+), 12 deletions(-) |
| |
| --- a/drivers/usb/host/xhci-debugfs.c |
| +++ b/drivers/usb/host/xhci-debugfs.c |
| @@ -202,10 +202,10 @@ static void xhci_ring_dump_segment(struc |
| trb = &seg->trbs[i]; |
| dma = seg->dma + i * sizeof(*trb); |
| seq_printf(s, "%pad: %s\n", &dma, |
| - xhci_decode_trb(trb->generic.field[0], |
| - trb->generic.field[1], |
| - trb->generic.field[2], |
| - trb->generic.field[3])); |
| + xhci_decode_trb(le32_to_cpu(trb->generic.field[0]), |
| + le32_to_cpu(trb->generic.field[1]), |
| + le32_to_cpu(trb->generic.field[2]), |
| + le32_to_cpu(trb->generic.field[3]))); |
| } |
| } |
| |
| @@ -263,10 +263,10 @@ static int xhci_slot_context_show(struct |
| xhci = hcd_to_xhci(bus_to_hcd(dev->udev->bus)); |
| slot_ctx = xhci_get_slot_ctx(xhci, dev->out_ctx); |
| seq_printf(s, "%pad: %s\n", &dev->out_ctx->dma, |
| - xhci_decode_slot_context(slot_ctx->dev_info, |
| - slot_ctx->dev_info2, |
| - slot_ctx->tt_info, |
| - slot_ctx->dev_state)); |
| + xhci_decode_slot_context(le32_to_cpu(slot_ctx->dev_info), |
| + le32_to_cpu(slot_ctx->dev_info2), |
| + le32_to_cpu(slot_ctx->tt_info), |
| + le32_to_cpu(slot_ctx->dev_state))); |
| |
| return 0; |
| } |
| @@ -286,10 +286,10 @@ static int xhci_endpoint_context_show(st |
| ep_ctx = xhci_get_ep_ctx(xhci, dev->out_ctx, dci); |
| dma = dev->out_ctx->dma + dci * CTX_SIZE(xhci->hcc_params); |
| seq_printf(s, "%pad: %s\n", &dma, |
| - xhci_decode_ep_context(ep_ctx->ep_info, |
| - ep_ctx->ep_info2, |
| - ep_ctx->deq, |
| - ep_ctx->tx_info)); |
| + xhci_decode_ep_context(le32_to_cpu(ep_ctx->ep_info), |
| + le32_to_cpu(ep_ctx->ep_info2), |
| + le64_to_cpu(ep_ctx->deq), |
| + le32_to_cpu(ep_ctx->tx_info))); |
| } |
| |
| return 0; |