Skip to content

Commit d5501d5

Browse files
bjdooks-ctgregkh
authored andcommitted
usb: xhci: fix __le32/__le64 accessors in debugfs code
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: <[email protected]> # 4.15+ Signed-off-by: Ben Dooks <[email protected]> Signed-off-by: Mathias Nyman <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent bfa3dbb commit d5501d5

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

drivers/usb/host/xhci-debugfs.c

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -202,10 +202,10 @@ static void xhci_ring_dump_segment(struct seq_file *s,
202202
trb = &seg->trbs[i];
203203
dma = seg->dma + i * sizeof(*trb);
204204
seq_printf(s, "%pad: %s\n", &dma,
205-
xhci_decode_trb(trb->generic.field[0],
206-
trb->generic.field[1],
207-
trb->generic.field[2],
208-
trb->generic.field[3]));
205+
xhci_decode_trb(le32_to_cpu(trb->generic.field[0]),
206+
le32_to_cpu(trb->generic.field[1]),
207+
le32_to_cpu(trb->generic.field[2]),
208+
le32_to_cpu(trb->generic.field[3])));
209209
}
210210
}
211211

@@ -263,10 +263,10 @@ static int xhci_slot_context_show(struct seq_file *s, void *unused)
263263
xhci = hcd_to_xhci(bus_to_hcd(dev->udev->bus));
264264
slot_ctx = xhci_get_slot_ctx(xhci, dev->out_ctx);
265265
seq_printf(s, "%pad: %s\n", &dev->out_ctx->dma,
266-
xhci_decode_slot_context(slot_ctx->dev_info,
267-
slot_ctx->dev_info2,
268-
slot_ctx->tt_info,
269-
slot_ctx->dev_state));
266+
xhci_decode_slot_context(le32_to_cpu(slot_ctx->dev_info),
267+
le32_to_cpu(slot_ctx->dev_info2),
268+
le32_to_cpu(slot_ctx->tt_info),
269+
le32_to_cpu(slot_ctx->dev_state)));
270270

271271
return 0;
272272
}
@@ -286,10 +286,10 @@ static int xhci_endpoint_context_show(struct seq_file *s, void *unused)
286286
ep_ctx = xhci_get_ep_ctx(xhci, dev->out_ctx, dci);
287287
dma = dev->out_ctx->dma + dci * CTX_SIZE(xhci->hcc_params);
288288
seq_printf(s, "%pad: %s\n", &dma,
289-
xhci_decode_ep_context(ep_ctx->ep_info,
290-
ep_ctx->ep_info2,
291-
ep_ctx->deq,
292-
ep_ctx->tx_info));
289+
xhci_decode_ep_context(le32_to_cpu(ep_ctx->ep_info),
290+
le32_to_cpu(ep_ctx->ep_info2),
291+
le64_to_cpu(ep_ctx->deq),
292+
le32_to_cpu(ep_ctx->tx_info)));
293293
}
294294

295295
return 0;

0 commit comments

Comments
 (0)