Skip to content

Commit 256dbcd

Browse files
AlanSterngregkh
authored andcommitted
USB: OHCI: fix bugs in debug routines
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 <[email protected]> CC: <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 6f65126 commit 256dbcd

File tree

2 files changed

+10
-9
lines changed

2 files changed

+10
-9
lines changed

drivers/usb/host/ohci-dbg.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,7 @@ ohci_dump_roothub (
236236
}
237237
}
238238

239-
static void ohci_dump (struct ohci_hcd *controller, int verbose)
239+
static void ohci_dump(struct ohci_hcd *controller)
240240
{
241241
ohci_dbg (controller, "OHCI controller state\n");
242242

@@ -464,15 +464,16 @@ show_list (struct ohci_hcd *ohci, char *buf, size_t count, struct ed *ed)
464464
static ssize_t fill_async_buffer(struct debug_buffer *buf)
465465
{
466466
struct ohci_hcd *ohci;
467-
size_t temp;
467+
size_t temp, size;
468468
unsigned long flags;
469469

470470
ohci = buf->ohci;
471+
size = PAGE_SIZE;
471472

472473
/* display control and bulk lists together, for simplicity */
473474
spin_lock_irqsave (&ohci->lock, flags);
474-
temp = show_list(ohci, buf->page, buf->count, ohci->ed_controltail);
475-
temp += show_list(ohci, buf->page + temp, buf->count - temp,
475+
temp = show_list(ohci, buf->page, size, ohci->ed_controltail);
476+
temp += show_list(ohci, buf->page + temp, size - temp,
476477
ohci->ed_bulktail);
477478
spin_unlock_irqrestore (&ohci->lock, flags);
478479

drivers/usb/host/ohci-hcd.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -76,8 +76,8 @@ static const char hcd_name [] = "ohci_hcd";
7676
#include "ohci.h"
7777
#include "pci-quirks.h"
7878

79-
static void ohci_dump (struct ohci_hcd *ohci, int verbose);
80-
static void ohci_stop (struct usb_hcd *hcd);
79+
static void ohci_dump(struct ohci_hcd *ohci);
80+
static void ohci_stop(struct usb_hcd *hcd);
8181

8282
#include "ohci-hub.c"
8383
#include "ohci-dbg.c"
@@ -770,7 +770,7 @@ static int ohci_run (struct ohci_hcd *ohci)
770770
ohci->ed_to_check = NULL;
771771
}
772772

773-
ohci_dump (ohci, 1);
773+
ohci_dump(ohci);
774774

775775
return 0;
776776
}
@@ -851,7 +851,7 @@ static irqreturn_t ohci_irq (struct usb_hcd *hcd)
851851
usb_hc_died(hcd);
852852
}
853853

854-
ohci_dump (ohci, 1);
854+
ohci_dump(ohci);
855855
ohci_usb_reset (ohci);
856856
}
857857

@@ -951,7 +951,7 @@ static void ohci_stop (struct usb_hcd *hcd)
951951
{
952952
struct ohci_hcd *ohci = hcd_to_ohci (hcd);
953953

954-
ohci_dump (ohci, 1);
954+
ohci_dump(ohci);
955955

956956
if (quirk_nec(ohci))
957957
flush_work(&ohci->nec_work);

0 commit comments

Comments
 (0)