ChangeSet 1.1867.3.45, 2004/09/21 11:17:31-07:00, [EMAIL PROTECTED]

[PATCH] usb speedtch: no side-effects in BUG_ON

It seems that people want BUG_ON to be like an assertion: harmless if removed.

Signed-off-by: Duncan Sands <[EMAIL PROTECTED]>
Signed-off-by: Greg Kroah-Hartman <[EMAIL PROTECTED]>


 drivers/usb/misc/speedtch.c |   17 +++++++++++------
 1 files changed, 11 insertions(+), 6 deletions(-)


diff -Nru a/drivers/usb/misc/speedtch.c b/drivers/usb/misc/speedtch.c
--- a/drivers/usb/misc/speedtch.c       2004-10-19 08:10:38 -07:00
+++ b/drivers/usb/misc/speedtch.c       2004-10-19 08:10:38 -07:00
@@ -93,7 +93,7 @@
 #ifdef DEBUG
 #define DEBUG_ON(x)    BUG_ON(x)
 #else
-#define DEBUG_ON(x)    do { if (x); } while (0)
+#define DEBUG_ON(x)
 #endif
 
 #ifdef VERBOSE_DEBUG
@@ -518,7 +518,8 @@
                memset (target, 0, ATM_CELL_PAYLOAD - ATM_AAL5_TRAILER);
                target += ATM_CELL_PAYLOAD - ATM_AAL5_TRAILER;
 
-               DEBUG_ON (--ctrl->num_cells);
+               --ctrl->num_cells;
+               DEBUG_ON (ctrl->num_cells);
        }
 
        memcpy (target, ctrl->aal5_trailer, ATM_AAL5_TRAILER);
@@ -1243,8 +1244,10 @@
        do {
                count = 0;
                spin_lock_irq (&instance->receive_lock);
-               list_for_each (pos, &instance->spare_receivers)
-                       DEBUG_ON (++count > num_rcv_urbs);
+               list_for_each (pos, &instance->spare_receivers) {
+                       ++count;
+                       DEBUG_ON (count > num_rcv_urbs);
+               }
                spin_unlock_irq (&instance->receive_lock);
 
                dbg ("udsl_usb_disconnect: found %u spare receivers", count);
@@ -1279,8 +1282,10 @@
        do {
                count = 0;
                spin_lock_irq (&instance->send_lock);
-               list_for_each (pos, &instance->spare_senders)
-                       DEBUG_ON (++count > num_snd_urbs);
+               list_for_each (pos, &instance->spare_senders) {
+                       ++count;
+                       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: IT Product Guide on ITManagersJournal
Use IT products in your business? Tell us what you think of them. Give us
Your Opinions, Get Free ThinkGeek Gift Certificates! Click to find out more
http://productguide.itmanagersjournal.com/guidepromo.tmpl
_______________________________________________
[EMAIL PROTECTED]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel

Reply via email to