diff options
author | Hans de Goede <hdegoede@redhat.com> | 2014-05-30 11:13:21 +0200 |
---|---|---|
committer | Hans de Goede <hdegoede@redhat.com> | 2014-05-30 11:13:21 +0200 |
commit | 8af0e460e1640f63b04d2a5db949dc88d890dff0 (patch) | |
tree | b115ec6cd5797e8eae04da6539e2fdd6571ac033 | |
parent | 64b20360a4ca54d5b3e85d0e34fb8ff83b7033de (diff) | |
download | libusb-8af0e460e1640f63b04d2a5db949dc88d890dff0.tar.gz |
linux_usbfs: Don't mark init_count as volatile
There is no reason to mark init_count as volatile, it is protected by the
linux_hotplug_startstop_lock. Removing the volatile marking fixes the
following Coverity warning:
*** CID 62574: Side effect in assertion (ASSERT_SIDE_EFFECT)
/libusb/os/linux_usbfs.c: 460 in op_exit()
454 return r;
455 }
456
457 static void op_exit(void)
458 {
459 usbi_mutex_static_lock(&linux_hotplug_startstop_lock);
>>> CID 62574: Side effect in assertion (ASSERT_SIDE_EFFECT)
>>> Argument "init_count" of assert() has a side effect because the variable is volatile. The containing function might work differently in a non-debug build.
460 assert(init_count != 0);
461 if (!--init_count) {
462 /* tear down event handler */
463 (void)linux_stop_event_monitor();
464 }
465 usbi_mutex_static_unlock(&linux_hotplug_startstop_lock);
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
-rw-r--r-- | libusb/os/linux_usbfs.c | 2 | ||||
-rw-r--r-- | libusb/version_nano.h | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/libusb/os/linux_usbfs.c b/libusb/os/linux_usbfs.c index 7cc1032..87e20a6 100644 --- a/libusb/os/linux_usbfs.c +++ b/libusb/os/linux_usbfs.c @@ -119,7 +119,7 @@ static int sysfs_can_relate_devices = -1; static int sysfs_has_descriptors = -1; /* how many times have we initted (and not exited) ? */ -static volatile int init_count = 0; +static int init_count = 0; /* Serialize hotplug start/stop */ usbi_mutex_static_t linux_hotplug_startstop_lock = USBI_MUTEX_INITIALIZER; diff --git a/libusb/version_nano.h b/libusb/version_nano.h index 70e0559..c938764 100644 --- a/libusb/version_nano.h +++ b/libusb/version_nano.h @@ -1 +1 @@ -#define LIBUSB_NANO 10894 +#define LIBUSB_NANO 10896 |