aboutsummaryrefslogtreecommitdiff
path: root/drivers/usb/mon/mon_bin.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2009-11-18 07:37:51 -0800
committerLinus Torvalds <torvalds@linux-foundation.org>2009-11-18 07:37:51 -0800
commit2d5bc23b32e0ec6fe9c1cdd9f371063881dc1ffc (patch)
tree3203cf45058a8ce7ebc3c712fd872e0c85fd5ccc /drivers/usb/mon/mon_bin.c
parent78db1caa8ae4e549ffc0bbf0f9b52c113e9a4da0 (diff)
parentff854ce0b17161a86b5ae444c6cb0aa221720fab (diff)
Merge git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb-2.6
* git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb-2.6: USB: option.c: add support for D-Link DWM-162-U5 USB: usbmon: fix bug in mon_buff_area_shrink USB: xhci: Fix scratchpad deallocation. USB: xhci: Fix TRB physical to virtual address translation. USB: xhci: Fix bug memory free after failed initialization. USB: cdc_acm: Fix memory leak after hangup USB: cdc_acm: Fix race condition when opening tty USB: ohci: quirk AMD prefetch for USB 1.1 ISO transfer
Diffstat (limited to 'drivers/usb/mon/mon_bin.c')
-rw-r--r--drivers/usb/mon/mon_bin.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/drivers/usb/mon/mon_bin.c b/drivers/usb/mon/mon_bin.c
index 9ed3e741bee..10f3205798e 100644
--- a/drivers/usb/mon/mon_bin.c
+++ b/drivers/usb/mon/mon_bin.c
@@ -348,12 +348,12 @@ static unsigned int mon_buff_area_alloc_contiguous(struct mon_reader_bin *rp,
/*
* Return a few (kilo-)bytes to the head of the buffer.
- * This is used if a DMA fetch fails.
+ * This is used if a data fetch fails.
*/
static void mon_buff_area_shrink(struct mon_reader_bin *rp, unsigned int size)
{
- size = (size + PKT_ALIGN-1) & ~(PKT_ALIGN-1);
+ /* size &= ~(PKT_ALIGN-1); -- we're called with aligned size */
rp->b_cnt -= size;
if (rp->b_in < size)
rp->b_in += rp->b_size;
@@ -433,6 +433,7 @@ static void mon_bin_event(struct mon_reader_bin *rp, struct urb *urb,
unsigned int urb_length;
unsigned int offset;
unsigned int length;
+ unsigned int delta;
unsigned int ndesc, lendesc;
unsigned char dir;
struct mon_bin_hdr *ep;
@@ -537,8 +538,10 @@ static void mon_bin_event(struct mon_reader_bin *rp, struct urb *urb,
if (length != 0) {
ep->flag_data = mon_bin_get_data(rp, offset, urb, length);
if (ep->flag_data != 0) { /* Yes, it's 0x00, not '0' */
- ep->len_cap = 0;
- mon_buff_area_shrink(rp, length);
+ delta = (ep->len_cap + PKT_ALIGN-1) & ~(PKT_ALIGN-1);
+ ep->len_cap -= length;
+ delta -= (ep->len_cap + PKT_ALIGN-1) & ~(PKT_ALIGN-1);
+ mon_buff_area_shrink(rp, delta);
}
} else {
ep->flag_data = data_tag;