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
This commit is contained in:
Lionel Sambuc 2014-09-12 13:20:40 +02:00
parent d5b158e992
commit 6631803105

View file

@ -180,6 +180,7 @@ void
hcd_os_nanosleep(int nanosec) hcd_os_nanosleep(int nanosec)
{ {
struct timespec nanotm; struct timespec nanotm;
int r;
DEBUG_DUMP; 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 /* 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 */ * to sleep for a remaining time in case of signal handling */
/* Signal handling will most likely end up with termination anyway */ /* Signal handling will most likely end up with termination anyway */
USB_ASSERT(EXIT_SUCCESS == nanosleep(&nanotm, NULL), r = nanosleep(&nanotm, NULL);
"Calling nanosleep() failed"); USB_ASSERT(EXIT_SUCCESS == r, "Calling nanosleep() failed");
} }