From bff104cdad6d55060085eb01f1fbeca400c88474 Mon Sep 17 00:00:00 2001 From: dragonmux Date: Fri, 28 Jul 2023 08:37:37 +0100 Subject: [PATCH] hosted/bmp_libusb: Unwraped the BMP product/version string handling main branch --- src/platforms/hosted/bmp_libusb.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/src/platforms/hosted/bmp_libusb.c b/src/platforms/hosted/bmp_libusb.c index 9d32ccc9557..ec4c7f8d221 100644 --- a/src/platforms/hosted/bmp_libusb.c +++ b/src/platforms/hosted/bmp_libusb.c @@ -143,15 +143,16 @@ void bmp_read_product_version(libusb_device_descriptor_s *device_descriptor, lib char *start_of_version = strrchr(*product, ' '); if (start_of_version == NULL) { *version = NULL; - } else { - while (start_of_version[0] == ' ' && start_of_version != *product) - --start_of_version; - start_of_version[1] = '\0'; - start_of_version += 2; - while (start_of_version[0] == ' ') - ++start_of_version; - *version = strdup(start_of_version); + return; } + + while (start_of_version[0] == ' ' && start_of_version != *product) + --start_of_version; + start_of_version[1] = '\0'; + start_of_version += 2; + while (start_of_version[0] == ' ') + ++start_of_version; + *version = strdup(start_of_version); } /*