Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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 <stern@rowland.harvard.edu>
CC: <stable@vger.kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Alan Stern and committed by
Greg Kroah-Hartman
256dbcd8 6f65126c

+10 -9
+5 -4
drivers/usb/host/ohci-dbg.c
··· 236 236 } 237 237 } 238 238 239 - static void ohci_dump (struct ohci_hcd *controller, int verbose) 239 + static void ohci_dump(struct ohci_hcd *controller) 240 240 { 241 241 ohci_dbg (controller, "OHCI controller state\n"); 242 242 ··· 464 464 static ssize_t fill_async_buffer(struct debug_buffer *buf) 465 465 { 466 466 struct ohci_hcd *ohci; 467 - size_t temp; 467 + size_t temp, size; 468 468 unsigned long flags; 469 469 470 470 ohci = buf->ohci; 471 + size = PAGE_SIZE; 471 472 472 473 /* display control and bulk lists together, for simplicity */ 473 474 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, 476 477 ohci->ed_bulktail); 477 478 spin_unlock_irqrestore (&ohci->lock, flags); 478 479
+5 -5
drivers/usb/host/ohci-hcd.c
··· 76 76 #include "ohci.h" 77 77 #include "pci-quirks.h" 78 78 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); 81 81 82 82 #include "ohci-hub.c" 83 83 #include "ohci-dbg.c" ··· 770 770 ohci->ed_to_check = NULL; 771 771 } 772 772 773 - ohci_dump (ohci, 1); 773 + ohci_dump(ohci); 774 774 775 775 return 0; 776 776 } ··· 851 851 usb_hc_died(hcd); 852 852 } 853 853 854 - ohci_dump (ohci, 1); 854 + ohci_dump(ohci); 855 855 ohci_usb_reset (ohci); 856 856 } 857 857 ··· 951 951 { 952 952 struct ohci_hcd *ohci = hcd_to_ohci (hcd); 953 953 954 - ohci_dump (ohci, 1); 954 + ohci_dump(ohci); 955 955 956 956 if (quirk_nec(ohci)) 957 957 flush_work(&ohci->nec_work);