-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Closed
Closed
Copy link
Labels
Stalearea: USBUniversal Serial BusUniversal Serial BusbugThe issue is a bug, or the PR is fixing a bugThe issue is a bug, or the PR is fixing a bugpriority: lowLow impact/importance bugLow impact/importance bug
Description
Hi,
The definition of function usb_set_config() is shown in the following code, and only the 0 code is returned.
zephyr/subsys/usb/usb_device.c
Lines 1447 to 1466 in fbc487c
| int usb_set_config(const uint8_t *device_descriptor) | |
| { | |
| /* register descriptors */ | |
| usb_register_descriptors(device_descriptor); | |
| /* register standard request handler */ | |
| usb_register_request_handler(REQTYPE_TYPE_STANDARD, | |
| usb_handle_standard_request); | |
| /* register class request handlers for each interface*/ | |
| usb_register_request_handler(REQTYPE_TYPE_CLASS, class_handler); | |
| /* register vendor request handler */ | |
| usb_register_request_handler(REQTYPE_TYPE_VENDOR, vendor_handler); | |
| /* register class request handlers for each interface*/ | |
| usb_register_custom_req_handler(custom_handler); | |
| return 0; | |
| } |
However, in the subsys/usb/class/usb_dfu.c, there exists an error check towards function usb_set_config(). See the following code, the error check condition is != 0, which will never happen according to the function usb_set_config() definition, resulting in the redundant error check code.
zephyr/subsys/usb/class/usb_dfu.c
Lines 582 to 585 in fbc487c
| if (usb_set_config(dfu_config.usb_device_description) != 0) { | |
| LOG_ERR("usb_set_config failed in DFU_DETACH"); | |
| return -EIO; | |
| } |
Metadata
Metadata
Assignees
Labels
Stalearea: USBUniversal Serial BusUniversal Serial BusbugThe issue is a bug, or the PR is fixing a bugThe issue is a bug, or the PR is fixing a bugpriority: lowLow impact/importance bugLow impact/importance bug