USB: OHCI: fix bugs in debug routines
authorAlan Stern <stern@rowland.harvard.edu>
Thu, 17 Jul 2014 20:32:26 +0000 (16:32 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 18 Jul 2014 00:05:07 +0000 (17:05 -0700)
The debug routine fill_async_buffer() in ohci-hcd is buggy: It never
produces any output because it forgets to initialize the output buffer
size.  Also, the debug routine ohci_dump() has an unused argument.

This patch adds the correct initialization and removes the unused
argument.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
CC: <stable@vger.kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/usb/host/ohci-dbg.c
drivers/usb/host/ohci-hcd.c

index 45032e933e18406b27897ad0b109ff4816e0b8c2..04f2186939d24681f582b591a8011c3516e6c933 100644 (file)
@@ -236,7 +236,7 @@ ohci_dump_roothub (
        }
 }
 
-static void ohci_dump (struct ohci_hcd *controller, int verbose)
+static void ohci_dump(struct ohci_hcd *controller)
 {
        ohci_dbg (controller, "OHCI controller state\n");
 
@@ -464,15 +464,16 @@ show_list (struct ohci_hcd *ohci, char *buf, size_t count, struct ed *ed)
 static ssize_t fill_async_buffer(struct debug_buffer *buf)
 {
        struct ohci_hcd         *ohci;
-       size_t                  temp;
+       size_t                  temp, size;
        unsigned long           flags;
 
        ohci = buf->ohci;
+       size = PAGE_SIZE;
 
        /* display control and bulk lists together, for simplicity */
        spin_lock_irqsave (&ohci->lock, flags);
-       temp = show_list(ohci, buf->page, buf->count, ohci->ed_controltail);
-       temp += show_list(ohci, buf->page + temp, buf->count - temp,
+       temp = show_list(ohci, buf->page, size, ohci->ed_controltail);
+       temp += show_list(ohci, buf->page + temp, size - temp,
                          ohci->ed_bulktail);
        spin_unlock_irqrestore (&ohci->lock, flags);
 
index 7f94c586c5dcb64f2c3a8c50fda6f3dbbc4b9b9f..7570098b1cfa3b3211800c183634851b934cba26 100644 (file)
@@ -76,8 +76,8 @@ static const char     hcd_name [] = "ohci_hcd";
 #include "ohci.h"
 #include "pci-quirks.h"
 
-static void ohci_dump (struct ohci_hcd *ohci, int verbose);
-static void ohci_stop (struct usb_hcd *hcd);
+static void ohci_dump(struct ohci_hcd *ohci);
+static void ohci_stop(struct usb_hcd *hcd);
 
 #include "ohci-hub.c"
 #include "ohci-dbg.c"
@@ -770,7 +770,7 @@ retry:
                ohci->ed_to_check = NULL;
        }
 
-       ohci_dump (ohci, 1);
+       ohci_dump(ohci);
 
        return 0;
 }
@@ -851,7 +851,7 @@ static irqreturn_t ohci_irq (struct usb_hcd *hcd)
                        usb_hc_died(hcd);
                }
 
-               ohci_dump (ohci, 1);
+               ohci_dump(ohci);
                ohci_usb_reset (ohci);
        }
 
@@ -951,7 +951,7 @@ static void ohci_stop (struct usb_hcd *hcd)
 {
        struct ohci_hcd         *ohci = hcd_to_ohci (hcd);
 
-       ohci_dump (ohci, 1);
+       ohci_dump(ohci);
 
        if (quirk_nec(ohci))
                flush_work(&ohci->nec_work);