Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

drivers/libusb1.c: Remove unnecessary validation for bus_num #2198

Merged
merged 1 commit into from Nov 24, 2023
Merged

drivers/libusb1.c: Remove unnecessary validation for bus_num #2198

merged 1 commit into from Nov 24, 2023

Conversation

delphij
Copy link
Contributor

@delphij delphij commented Nov 24, 2023

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

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>
@jimklimov jimklimov added bug USB portability We want NUT to build and run everywhere possible labels Nov 24, 2023
@jimklimov jimklimov added this to the 2.8.2 milestone Nov 24, 2023
@jimklimov
Copy link
Member

Thanks! I've now re-checked that this issue does not apply to our libusb0.c and nut-scanner/scan_usb.c sources.

@jimklimov jimklimov merged commit 4aeb199 into networkupstools:master Nov 24, 2023
12 checks passed
freebsd-git pushed a commit to freebsd/freebsd-ports that referenced this pull request Nov 24, 2023
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:	networkupstools/nut#2198
@delphij delphij deleted the libusb1-bugfix branch November 24, 2023 17:06
jimklimov added a commit to jimklimov/nut that referenced this pull request Nov 25, 2023
Signed-off-by: Jim Klimov <jimklimov+nut@gmail.com>
netgate-git-updates pushed a commit to pfsense/FreeBSD-ports that referenced this pull request Nov 27, 2023
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:	networkupstools/nut#2198
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug portability We want NUT to build and run everywhere possible USB
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants