diff options
author | Nathan Hjelm <hjelmn@me.com> | 2013-08-26 20:12:23 -0600 |
---|---|---|
committer | Nathan Hjelm <hjelmn@me.com> | 2013-08-26 20:12:23 -0600 |
commit | 7b14df40b00d82adeae99367f64076823c23684f (patch) | |
tree | fddee4d5b2cce17ca7a9a11d7dcd1963457af50d | |
parent | 0837c479dc197b27884d717bf4ddc31cae65afd9 (diff) | |
download | libusb-7b14df40b00d82adeae99367f64076823c23684f.tar.gz |
darwin: clean up some code. remove a clang warning
The check for NULL != cached_device was unnecessary and caused clang's
static analysis to print out a warning.
-rw-r--r-- | libusb/os/darwin_usb.c | 18 | ||||
-rw-r--r-- | libusb/version_nano.h | 2 |
2 files changed, 8 insertions, 12 deletions
diff --git a/libusb/os/darwin_usb.c b/libusb/os/darwin_usb.c index b0ee5b2..933fcd7 100644 --- a/libusb/os/darwin_usb.c +++ b/libusb/os/darwin_usb.c @@ -743,8 +743,6 @@ static int darwin_get_cached_device(struct libusb_context *ctx, io_service_t ser kern_return_t result; UInt8 port = 0; - *cached_out = NULL; - /* get some info from the io registry */ (void) get_ioregistry_value_number (service, CFSTR("sessionID"), kCFNumberSInt64Type, &sessionID); (void) get_ioregistry_value_number (service, CFSTR("PortNum"), kCFNumberSInt8Type, &port); @@ -774,17 +772,15 @@ static int darwin_get_cached_device(struct libusb_context *ctx, io_service_t ser usbi_dbg("caching new device with sessionID 0x%x\n", sessionID); - new_device = calloc (1, sizeof (*new_device)); - if (!new_device) { - ret = LIBUSB_ERROR_NO_MEM; - break; - } - device = darwin_device_from_service (service); if (!device) { ret = LIBUSB_ERROR_NO_DEVICE; - free (new_device); - new_device = NULL; + break; + } + + new_device = calloc (1, sizeof (*new_device)); + if (!new_device) { + ret = LIBUSB_ERROR_NO_MEM; break; } @@ -834,7 +830,7 @@ static int process_new_device (struct libusb_context *ctx, io_service_t service) do { ret = darwin_get_cached_device (ctx, service, &cached_device); - if (ret < 0 || (cached_device && !cached_device->can_enumerate)) { + if (ret < 0 || !cached_device->can_enumerate) { return ret; } diff --git a/libusb/version_nano.h b/libusb/version_nano.h index 2e56b17..623a0bb 100644 --- a/libusb/version_nano.h +++ b/libusb/version_nano.h @@ -1 +1 @@ -#define LIBUSB_NANO 10821 +#define LIBUSB_NANO 10822 |