linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] usb: xhci: fix __le32/__le64 accessors in debugfs code
@ 2019-10-15 15:21 Ben Dooks (Codethink)
  2019-10-24 10:22 ` Mathias Nyman
  0 siblings, 1 reply; 2+ messages in thread
From: Ben Dooks (Codethink) @ 2019-10-15 15:21 UTC (permalink / raw)
  To: linux-kernel
  Cc: Ben Dooks (Codethink),
	Mathias Nyman, Greg Kroah-Hartman, linux-usb, linux-kernel

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;

drivers/usb/host/xhci-debugfs.c:205:62: warning: incorrect type in argument 1 (different base types)
drivers/usb/host/xhci-debugfs.c:205:62:    expected unsigned int [usertype] field0
drivers/usb/host/xhci-debugfs.c:205:62:    got restricted __le32
drivers/usb/host/xhci-debugfs.c:206:62: warning: incorrect type in argument 2 (different base types)
drivers/usb/host/xhci-debugfs.c:206:62:    expected unsigned int [usertype] field1
drivers/usb/host/xhci-debugfs.c:206:62:    got restricted __le32
drivers/usb/host/xhci-debugfs.c:207:62: warning: incorrect type in argument 3 (different base types)
drivers/usb/host/xhci-debugfs.c:207:62:    expected unsigned int [usertype] field2
drivers/usb/host/xhci-debugfs.c:207:62:    got restricted __le32
drivers/usb/host/xhci-debugfs.c:208:62: warning: incorrect type in argument 4 (different base types)
drivers/usb/host/xhci-debugfs.c:208:62:    expected unsigned int [usertype] field3
drivers/usb/host/xhci-debugfs.c:208:62:    got restricted __le32
drivers/usb/host/xhci-debugfs.c:266:53: warning: incorrect type in argument 1 (different base types)
drivers/usb/host/xhci-debugfs.c:266:53:    expected unsigned int [usertype] info
drivers/usb/host/xhci-debugfs.c:266:53:    got restricted __le32 [usertype] dev_info
drivers/usb/host/xhci-debugfs.c:267:53: warning: incorrect type in argument 2 (different base types)
drivers/usb/host/xhci-debugfs.c:267:53:    expected unsigned int [usertype] info2
drivers/usb/host/xhci-debugfs.c:267:53:    got restricted __le32 [usertype] dev_info2
drivers/usb/host/xhci-debugfs.c:268:53: warning: incorrect type in argument 3 (different base types)
drivers/usb/host/xhci-debugfs.c:268:53:    expected unsigned int [usertype] tt_info
drivers/usb/host/xhci-debugfs.c:268:53:    got restricted __le32 [usertype] tt_info
drivers/usb/host/xhci-debugfs.c:269:53: warning: incorrect type in argument 4 (different base types)
drivers/usb/host/xhci-debugfs.c:269:53:    expected unsigned int [usertype] state
drivers/usb/host/xhci-debugfs.c:269:53:    got restricted __le32 [usertype] dev_state
drivers/usb/host/xhci-debugfs.c:289:57: warning: incorrect type in argument 1 (different base types)
drivers/usb/host/xhci-debugfs.c:289:57:    expected unsigned int [usertype] info
drivers/usb/host/xhci-debugfs.c:289:57:    got restricted __le32 [usertype] ep_info
drivers/usb/host/xhci-debugfs.c:290:57: warning: incorrect type in argument 2 (different base types)
drivers/usb/host/xhci-debugfs.c:290:57:    expected unsigned int [usertype] info2
drivers/usb/host/xhci-debugfs.c:290:57:    got restricted __le32 [usertype] ep_info2
drivers/usb/host/xhci-debugfs.c:291:57: warning: incorrect type in argument 3 (different base types)
drivers/usb/host/xhci-debugfs.c:291:57:    expected unsigned long long [usertype] deq
drivers/usb/host/xhci-debugfs.c:291:57:    got restricted __le64 [usertype] deq
drivers/usb/host/xhci-debugfs.c:292:57: warning: incorrect type in argument 4 (different base types)
drivers/usb/host/xhci-debugfs.c:292:57:    expected unsigned int [usertype] tx_info
drivers/usb/host/xhci-debugfs.c:292:57:    got restricted __le32 [usertype] tx_info

Signed-off-by: Ben Dooks <ben.dooks@codethink.co.uk>
---
Cc: Mathias Nyman <mathias.nyman@intel.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: linux-usb@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
.. (open list)
---
 drivers/usb/host/xhci-debugfs.c | 24 ++++++++++++------------
 1 file changed, 12 insertions(+), 12 deletions(-)

diff --git a/drivers/usb/host/xhci-debugfs.c b/drivers/usb/host/xhci-debugfs.c
index 7ba6afc7ef23..76c3f29562d2 100644
--- a/drivers/usb/host/xhci-debugfs.c
+++ b/drivers/usb/host/xhci-debugfs.c
@@ -202,10 +202,10 @@ static void xhci_ring_dump_segment(struct seq_file *s,
 		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 seq_file *s, void *unused)
 	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(struct seq_file *s, void *unused)
 		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;
-- 
2.23.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] usb: xhci: fix __le32/__le64 accessors in debugfs code
  2019-10-15 15:21 [PATCH] usb: xhci: fix __le32/__le64 accessors in debugfs code Ben Dooks (Codethink)
@ 2019-10-24 10:22 ` Mathias Nyman
  0 siblings, 0 replies; 2+ messages in thread
From: Mathias Nyman @ 2019-10-24 10:22 UTC (permalink / raw)
  To: Ben Dooks (Codethink), linux-kernel
  Cc: Mathias Nyman, Greg Kroah-Hartman, linux-usb, linux-kernel

On 15.10.2019 18.21, Ben Dooks (Codethink) wrote:
> 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;
> 

Thanks, adding to queue

-Mathias

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-10-24 10:20 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-15 15:21 [PATCH] usb: xhci: fix __le32/__le64 accessors in debugfs code Ben Dooks (Codethink)
2019-10-24 10:22 ` Mathias Nyman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).