From 81ac3bd6df9d549d74d8f6999b059a51eaf34212 Mon Sep 17 00:00:00 2001 From: Rickard Date: Thu, 5 Mar 2020 11:27:09 +0100 Subject: [PATCH] usb_relay_device_enumerate: looking at error code, silencing -Wunused-but-set-variable --- lib/usb_relay_device.h | 2 +- lib/usb_relay_lib.c | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/usb_relay_device.h b/lib/usb_relay_device.h index 19a62df..8c08e26 100644 --- a/lib/usb_relay_device.h +++ b/lib/usb_relay_device.h @@ -70,7 +70,7 @@ It should be called at the end of execution to avoid memory leaks. int USBRL_API usb_relay_exit(void); /** Enumerate the USB Relay Devices. -@return Pointer to list of usb_relay_device_info +@return Pointer to list of usb_relay_device_info, NULL if unsuccessful. Caller should free it with usb_relay_device_free_enumerate */ pusb_relay_device_info_t USBRL_API usb_relay_device_enumerate(void); diff --git a/lib/usb_relay_lib.c b/lib/usb_relay_lib.c index 8758460..f7869f8 100644 --- a/lib/usb_relay_lib.c +++ b/lib/usb_relay_lib.c @@ -385,6 +385,9 @@ pusb_relay_device_info_t USBRL_API usb_relay_device_enumerate(void) (void*)&ectx, enumfunc); + if ( ret != 0 ) + return NULL; + return (pusb_relay_device_info_t)ectx.head; }