diff mbox series

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

Message ID 1594393785-15182-1-git-send-email-jun.li@nxp.com (mailing list archive)
State New, archived
Headers show
Series usb: host: xhci: fix ep context print mismatch in debugfs | expand

Commit Message

Jun Li July 10, 2020, 3:09 p.m. UTC
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")
Signed-off-by: Li Jun <jun.li@nxp.com>
---
 drivers/usb/host/xhci-debugfs.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Mathias Nyman July 20, 2020, 11:56 a.m. UTC | #1
On 10.7.2020 18.09, Li Jun wrote:
> 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")
> Signed-off-by: Li Jun <jun.li@nxp.com>
> ---
>  drivers/usb/host/xhci-debugfs.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/usb/host/xhci-debugfs.c b/drivers/usb/host/xhci-debugfs.c
> index 76c3f29..65d8de4 100644
> --- a/drivers/usb/host/xhci-debugfs.c
> +++ b/drivers/usb/host/xhci-debugfs.c
> @@ -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),
> 

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
diff mbox series

Patch

diff --git a/drivers/usb/host/xhci-debugfs.c b/drivers/usb/host/xhci-debugfs.c
index 76c3f29..65d8de4 100644
--- a/drivers/usb/host/xhci-debugfs.c
+++ b/drivers/usb/host/xhci-debugfs.c
@@ -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),