diff options
author | 2023-11-18 00:35:38 +0100 | |
---|---|---|
committer | 2023-11-18 00:35:38 +0100 | |
commit | d15e34768865ff2348a88bc095f341a15da44677 (patch) | |
tree | 4d66cabb110d323ae4ee139afa42176eda221462 | |
parent | 1535d99933d3c31c651cdf03c659d8ef0708291a (diff) | |
download | libirecovery-d15e34768865ff2348a88bc095f341a15da44677.tar.gz libirecovery-d15e34768865ff2348a88bc095f341a15da44677.tar.bz2 |
IOKit: Silence some compiler warnings about unused variables
-rw-r--r-- | src/libirecovery.c | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/src/libirecovery.c b/src/libirecovery.c index d5e8e73..dc55c95 100644 --- a/src/libirecovery.c +++ b/src/libirecovery.c | |||
@@ -2258,7 +2258,15 @@ static int _irecv_is_recovery_device(void *device) | |||
2258 | kern_return_t kr; | 2258 | kern_return_t kr; |
2259 | IOUSBDeviceInterface **dev = device; | 2259 | IOUSBDeviceInterface **dev = device; |
2260 | kr = (*dev)->GetDeviceVendor(dev, &vendor_id); | 2260 | kr = (*dev)->GetDeviceVendor(dev, &vendor_id); |
2261 | if (kr != kIOReturnSuccess) { | ||
2262 | debug("%s: Failed to get vendor id\n", __func__); | ||
2263 | return 0; | ||
2264 | } | ||
2261 | kr = (*dev)->GetDeviceProduct(dev, &product_id); | 2265 | kr = (*dev)->GetDeviceProduct(dev, &product_id); |
2266 | if (kr != kIOReturnSuccess) { | ||
2267 | debug("%s: Failed to get product id\n", __func__); | ||
2268 | return 0; | ||
2269 | } | ||
2262 | #else | 2270 | #else |
2263 | libusb_device *device_ = (libusb_device*)device; | 2271 | libusb_device *device_ = (libusb_device*)device; |
2264 | struct libusb_device_descriptor devdesc; | 2272 | struct libusb_device_descriptor devdesc; |
@@ -2507,7 +2515,7 @@ static void iokit_device_added(void *refcon, io_iterator_t iterator) | |||
2507 | kr = IOCreatePlugInInterfaceForService(device, kIOUSBDeviceUserClientTypeID, kIOCFPlugInInterfaceID, &plugInInterface, &score); | 2515 | kr = IOCreatePlugInInterfaceForService(device, kIOUSBDeviceUserClientTypeID, kIOCFPlugInInterfaceID, &plugInInterface, &score); |
2508 | if ((kIOReturnSuccess != kr) || !plugInInterface) { | 2516 | if ((kIOReturnSuccess != kr) || !plugInInterface) { |
2509 | debug("%s: ERROR: Unable to create a plug-in (%08x)\n", __func__, kr); | 2517 | debug("%s: ERROR: Unable to create a plug-in (%08x)\n", __func__, kr); |
2510 | kr = IOObjectRelease(device); | 2518 | IOObjectRelease(device); |
2511 | continue; | 2519 | continue; |
2512 | } | 2520 | } |
2513 | result = (*plugInInterface)->QueryInterface(plugInInterface, CFUUIDGetUUIDBytes(kIOUSBDeviceInterfaceID320), (LPVOID *)&dev); | 2521 | result = (*plugInInterface)->QueryInterface(plugInInterface, CFUUIDGetUUIDBytes(kIOUSBDeviceInterfaceID320), (LPVOID *)&dev); |
@@ -2515,13 +2523,13 @@ static void iokit_device_added(void *refcon, io_iterator_t iterator) | |||
2515 | 2523 | ||
2516 | if (result || !dev) { | 2524 | if (result || !dev) { |
2517 | debug("%s: ERROR: Couldn't create a device interface (%08x)\n", __func__, (int)result); | 2525 | debug("%s: ERROR: Couldn't create a device interface (%08x)\n", __func__, (int)result); |
2518 | kr = IOObjectRelease(device); | 2526 | IOObjectRelease(device); |
2519 | continue; | 2527 | continue; |
2520 | } | 2528 | } |
2521 | 2529 | ||
2522 | if (!_irecv_is_recovery_device(dev)) { | 2530 | if (!_irecv_is_recovery_device(dev)) { |
2523 | (void) (*dev)->Release(dev); | 2531 | (void) (*dev)->Release(dev); |
2524 | kr = IOObjectRelease(device); | 2532 | IOObjectRelease(device); |
2525 | continue; | 2533 | continue; |
2526 | } | 2534 | } |
2527 | 2535 | ||
@@ -2530,7 +2538,7 @@ static void iokit_device_added(void *refcon, io_iterator_t iterator) | |||
2530 | idev.dev = dev; | 2538 | idev.dev = dev; |
2531 | _irecv_handle_device_add(&idev); | 2539 | _irecv_handle_device_add(&idev); |
2532 | (void) (*dev)->Release(dev); | 2540 | (void) (*dev)->Release(dev); |
2533 | kr = IOObjectRelease(device); | 2541 | IOObjectRelease(device); |
2534 | } | 2542 | } |
2535 | } | 2543 | } |
2536 | 2544 | ||
@@ -2719,10 +2727,16 @@ static void *_irecv_event_handler(void* data) | |||
2719 | 2727 | ||
2720 | io_iterator_t devAddedIter; | 2728 | io_iterator_t devAddedIter; |
2721 | kr = IOServiceAddMatchingNotification(notifyPort, kIOFirstMatchNotification, matchingDict, iokit_device_added, NULL, &devAddedIter); | 2729 | kr = IOServiceAddMatchingNotification(notifyPort, kIOFirstMatchNotification, matchingDict, iokit_device_added, NULL, &devAddedIter); |
2730 | if (kr != kIOReturnSuccess) { | ||
2731 | debug("%s: Failed to register device add notification callback\n", __func__); | ||
2732 | } | ||
2722 | iokit_device_added(NULL, devAddedIter); | 2733 | iokit_device_added(NULL, devAddedIter); |
2723 | 2734 | ||
2724 | io_iterator_t devRemovedIter; | 2735 | io_iterator_t devRemovedIter; |
2725 | kr = IOServiceAddMatchingNotification(notifyPort, kIOTerminatedNotification, matchingDict, iokit_device_removed, NULL, &devRemovedIter); | 2736 | kr = IOServiceAddMatchingNotification(notifyPort, kIOTerminatedNotification, matchingDict, iokit_device_removed, NULL, &devRemovedIter); |
2737 | if (kr != kIOReturnSuccess) { | ||
2738 | debug("%s: Failed to register device remove notification callback\n", __func__); | ||
2739 | } | ||
2726 | iokit_device_removed(NULL, devRemovedIter); | 2740 | iokit_device_removed(NULL, devRemovedIter); |
2727 | 2741 | ||
2728 | i++; | 2742 | i++; |