Skip to contentSkip to conversation

usb: host: xhci: fix ep context print mismatch in debugfs

PATCH In review Li Jun 2 participants 2 messages Jul 10, 2020 – Jul 20, 2020

Subsystems (2)
lore
Share & tools
lore

Li Jun

author
#0 lore raw

PATCH 1/1 usb: host: xhci: fix ep context print mismatch in debugfs

dci is 0 based and xhci_get_ep_ctx() will do ep index increment to get the ep context.

Fixes 02b6fdc2a153 ("usb: xhci: Add debugfs interface for xHCI driver")
---
 drivers/usb/host/xhci-debugfs.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/usb/host/xhci-debugfs.c +2 -2
index 76c3f29..65d8de4 100644
@@ -282,9 +282,9 @@ static int xhci_endpoint_context_show(struct seq_file *s, void *unused)
 
 	xhci = hcd_to_xhci(bus_to_hcd(dev->udev->bus));
 
-	for (dci = 1; dci < 32; dci++) {
+	for (dci = 0; dci < 31; dci++) {
 		ep_ctx = xhci_get_ep_ctx(xhci, dev->out_ctx, dci);
-		dma = dev->out_ctx->dma + dci * CTX_SIZE(xhci->hcc_params);
+		dma = dev->out_ctx->dma + (dci + 1) * CTX_SIZE(xhci->hcc_params);
 		seq_printf(s, "%pad: %s\n", &dma,
 			   xhci_decode_ep_context(le32_to_cpu(ep_ctx->ep_info),
 						  le32_to_cpu(ep_ctx->ep_info2),
Signature · 1 line
2.7.4
maintainer
#1 lore raw
Quoted 16 lines · Li Jun

dci is 0 based and xhci_get_ep_ctx() will do ep index increment to get the ep context.

Fixes 02b6fdc2a153 ("usb: xhci: Add debugfs interface for xHCI driver")
---
 drivers/usb/host/xhci-debugfs.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/usb/host/xhci-debugfs.c +0 -0
index 76c3f29..65d8de4 100644
@@ -282,9 +282,9 @@ static int xhci_endpoint_context_show(struct seq_file *s, void *unused)
 

drivers/usb/host/xhci-debugfs.c static int xhci_endpoint_context_show(struct seq_file *s, void *unused) · line 290

Quoted 10 lines
drivers/usb/host/xhci-debugfs.c +2 -2
 	xhci = hcd_to_xhci(bus_to_hcd(dev->udev->bus));
 
-	for (dci = 1; dci < 32; dci++) {
+	for (dci = 0; dci < 31; dci++) {
 		ep_ctx = xhci_get_ep_ctx(xhci, dev->out_ctx, dci);
-		dma = dev->out_ctx->dma + dci * CTX_SIZE(xhci->hcc_params);
+		dma = dev->out_ctx->dma + (dci + 1) * CTX_SIZE(xhci->hcc_params);
 		seq_printf(s, "%pad: %s\n", &dma,
 			   xhci_decode_ep_context(le32_to_cpu(ep_ctx->ep_info),
 						  le32_to_cpu(ep_ctx->ep_info2),

Thanks, adding to queue.
I'll probably change "dci" to "ep_index" while applying this as it doesn't represent the Device Context Index (DCI) in the xhci specs

-Mathias