diff options
author | Vadim Yanitskiy <vyanitskiy@sysmocom.de> | 2021-10-25 00:30:27 +0300 |
---|---|---|
committer | Vadim Yanitskiy <vyanitskiy@sysmocom.de> | 2021-10-25 13:12:51 +0300 |
commit | 019d69812642d6e49b0bfb5f41179ff5f4d464e0 (patch) | |
tree | 0bafc7abac4677abde1f192deb036229a729fe7f | |
parent | a686277c725074ac3966396548789cd13fce3833 (diff) |
LMSDevice: LMS_GetDeviceList() may return a negative number
Change-Id: I855bd8ea6d9cb0f285f4dbbf3bcd09bff4e71044
Fixes: CID#240718
-rw-r--r-- | Transceiver52M/device/lms/LMSDevice.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/Transceiver52M/device/lms/LMSDevice.cpp b/Transceiver52M/device/lms/LMSDevice.cpp index 6e5002c..d1ec2e4 100644 --- a/Transceiver52M/device/lms/LMSDevice.cpp +++ b/Transceiver52M/device/lms/LMSDevice.cpp @@ -277,11 +277,12 @@ int LMSDevice::open(const std::string &args, int ref, bool swap_channels) LMS_RegisterLogHandler(&lms_log_callback); - if ((n = LMS_GetDeviceList(NULL)) < 0) + if ((rc = LMS_GetDeviceList(NULL)) < 0) LOGC(DDEV, ERROR) << "LMS_GetDeviceList(NULL) failed"; - LOGC(DDEV, INFO) << "Devices found: " << n; - if (n < 1) + LOGC(DDEV, INFO) << "Devices found: " << rc; + if (rc < 1) return -1; + n = rc; info_list = new lms_info_str_t[n]; |