From: Lionel Sambuc Date: Fri, 12 Sep 2014 11:20:40 +0000 (+0200) Subject: usb/hcd: asserts should not have side effects X-Git-Tag: v3.3.0~6 X-Git-Url: http://zhaoyanbai.com/repos/?a=commitdiff_plain;h=refs%2Fchanges%2F26%2F2826%2F1;p=minix.git usb/hcd: asserts should not have side effects They can be deactivated with -DNDEBUG, which is why they can't contain code which should always be run. It seems the local implementation of USB_ASSERT doesn't honor the CPP flags NDEBUG, this will be corrected in a later patch. Change-Id: Iac56b09fd563f1b8c4c7be15a468a05b9cc86a18 --- diff --git a/minix/drivers/usb/usbd/hcd/hcd_common.c b/minix/drivers/usb/usbd/hcd/hcd_common.c index d6b6f798c..03aa998eb 100644 --- a/minix/drivers/usb/usbd/hcd/hcd_common.c +++ b/minix/drivers/usb/usbd/hcd/hcd_common.c @@ -180,6 +180,7 @@ void hcd_os_nanosleep(int nanosec) { struct timespec nanotm; + int r; DEBUG_DUMP; @@ -194,8 +195,8 @@ hcd_os_nanosleep(int nanosec) /* TODO: Since it is not likely to be ever interrupted, we do not try * to sleep for a remaining time in case of signal handling */ /* Signal handling will most likely end up with termination anyway */ - USB_ASSERT(EXIT_SUCCESS == nanosleep(&nanotm, NULL), - "Calling nanosleep() failed"); + r = nanosleep(&nanotm, NULL); + USB_ASSERT(EXIT_SUCCESS == r, "Calling nanosleep() failed"); }