ChangeSet 1.1315.8.5, 2003/09/16 11:18:08-07:00, [EMAIL PROTECTED]
[PATCH] USB speedtouch: neater sanity check
Biscuit for Greg.
drivers/usb/misc/speedtch.c | 17 ++++++++++-------
1 files changed, 10 insertions(+), 7 deletions(-)
diff -Nru a/drivers/usb/misc/speedtch.c b/drivers/usb/misc/speedtch.c
--- a/drivers/usb/misc/speedtch.c Fri Sep 19 17:15:09 2003
+++ b/drivers/usb/misc/speedtch.c Fri Sep 19 17:15:09 2003
@@ -84,6 +84,11 @@
#include <linux/usb.h>
+#ifdef DEBUG
+#define DEBUG_ON(x) BUG_ON(x)
+#else
+#define DEBUG_ON(x) do { if (x); } while (0)
+#endif
#ifdef VERBOSE_DEBUG
static int udsl_print_packet (const unsigned char *data, int len);
@@ -351,7 +356,7 @@
dbg ("udsl_extract_cells: buffer overrun (max_pdu: %u,
skb->len %u, vcc: 0x%p)", vcc_data->max_pdu, skb->len, vcc);
/* discard cells already received */
skb_trim (skb, 0);
- BUG_ON (vcc_data->max_pdu < ATM_CELL_PAYLOAD);
+ DEBUG_ON (vcc_data->max_pdu < ATM_CELL_PAYLOAD);
}
memcpy (skb->tail, source + ATM_CELL_HEADER, ATM_CELL_PAYLOAD);
@@ -498,7 +503,7 @@
memset (target, 0, ATM_CELL_PAYLOAD - ATM_AAL5_TRAILER);
target += ATM_CELL_PAYLOAD - ATM_AAL5_TRAILER;
- BUG_ON (--ctrl->num_cells);
+ DEBUG_ON (--ctrl->num_cells);
}
memcpy (target, ctrl->aal5_trailer, ATM_AAL5_TRAILER);
@@ -535,7 +540,7 @@
vdbg ("udsl_complete_receive: urb 0x%p, status %d, actual_length %d,
filled_cells %u, rcv 0x%p, buf 0x%p", urb, urb->status, urb->actual_length,
buf->filled_cells, rcv, buf);
- BUG_ON (buf->filled_cells > rcv_buf_size);
+ DEBUG_ON (buf->filled_cells > rcv_buf_size);
/* may not be in_interrupt() */
spin_lock_irqsave (&instance->receive_lock, flags);
@@ -1216,8 +1221,7 @@
count = 0;
spin_lock_irq (&instance->receive_lock);
list_for_each (pos, &instance->spare_receivers)
- if (++count > num_rcv_urbs)
- panic (__FILE__ ": memory corruption detected at line
%d!\n", __LINE__);
+ DEBUG_ON (++count > num_rcv_urbs);
spin_unlock_irq (&instance->receive_lock);
dbg ("udsl_usb_disconnect: found %u spare receivers", count);
@@ -1253,8 +1257,7 @@
count = 0;
spin_lock_irq (&instance->send_lock);
list_for_each (pos, &instance->spare_senders)
- if (++count > num_snd_urbs)
- panic (__FILE__ ": memory corruption detected at line
%d!\n", __LINE__);
+ DEBUG_ON (++count > num_snd_urbs);
spin_unlock_irq (&instance->send_lock);
dbg ("udsl_usb_disconnect: found %u spare senders", count);
-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
[EMAIL PROTECTED]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel