mirror of
https://git.freebsd.org/ports.git
synced 2025-05-12 23:31:50 -04:00
The libusb_get_bus_number() function serves as a simple accessor for the bus number of the opaque device struct. Unlike libusb_get_port_number(), it does not have the ability to convey errors back to the caller, and a bus number of 0 is a valid value. Therefore, any validation around bus_num is redundant. This commit removes the unnecessary validation code related to bus_num. Signed-off-by: Xin LI <delphij@FreeBSD.org> PR: 275293 Upstream commit: 4aeb199eb Upstream Pull Request: https://github.com/networkupstools/nut/pull/2198/
18 lines
598 B
C
18 lines
598 B
C
--- drivers/libusb1.c.orig 2023-11-24 07:19:04.377537000 -0800
|
|
+++ drivers/libusb1.c 2023-11-24 07:20:06.065188000 -0800
|
|
@@ -263,14 +263,7 @@
|
|
libusb_free_device_list(devlist, 1);
|
|
fatal_with_errno(EXIT_FAILURE, "Out of memory");
|
|
}
|
|
- if (bus_num > 0) {
|
|
- sprintf(curDevice->Bus, "%03d", bus_num);
|
|
- } else {
|
|
- upsdebugx(1, "%s: invalid libusb bus number %i",
|
|
- __func__, bus_num);
|
|
- free(curDevice->Bus);
|
|
- curDevice->Bus = NULL;
|
|
- }
|
|
+ sprintf(curDevice->Bus, "%03d", bus_num);
|
|
|
|
device_addr = libusb_get_device_address(device);
|
|
curDevice->Device = (char *)malloc(4);
|