Skip to content

usb: host: add missing const qualifier#103579

Closed
fabiobaltieri wants to merge 1 commit intozephyrproject-rtos:mainfrom
fabiobaltieri:usb-hot
Closed

usb: host: add missing const qualifier#103579
fabiobaltieri wants to merge 1 commit intozephyrproject-rtos:mainfrom
fabiobaltieri:usb-hot

Conversation

@fabiobaltieri
Copy link
Copy Markdown
Member

Add missing const qualifier, fix build issue found when building with clang:

$ export ZEPHYR_TOOLCHAIN_VARIANT=llvm
$ west build -p -b native_sim/native tests/subsys/usb/device_next ...
zephyrproject/zephyr/subsys/usb/host/usbh_desc.c:16:6: error: conflicting types for 'usbh_desc_is_valid'
16 | bool usbh_desc_is_valid(const void *const desc,
| ^
/home/fabiobaltieri/zephyrproject/zephyr/subsys/usb/host/usbh_desc.h:92:12:
note: previous declaration is here
92 | const bool usbh_desc_is_valid(const void *const desc,
| ^

@fabiobaltieri fabiobaltieri added the Hotfix Fix for issues blocking development, i.e. upstream CI issues, tests failing in upstream CI , etc. label Feb 5, 2026
@zephyrbot zephyrbot added area: USB Universal Serial Bus size: XS A PR changing only a single line of code labels Feb 5, 2026
Add missing const qualifier, fix build issue found when building with
clang:

$ export ZEPHYR_TOOLCHAIN_VARIANT=llvm
$ west build -p -b native_sim/native tests/subsys/usb/device_next
...
zephyrproject/zephyr/subsys/usb/host/usbh_desc.c:16:6: error:
conflicting types for 'usbh_desc_is_valid'
   16 | bool usbh_desc_is_valid(const void *const desc,
      |      ^
zephyrproject/zephyr/subsys/usb/host/usbh_desc.h:92:12:
note: previous declaration is here
   92 | const bool usbh_desc_is_valid(const void *const desc,
      |            ^

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
@zephyrbot zephyrbot removed the size: XS A PR changing only a single line of code label Feb 5, 2026
@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud Bot commented Feb 5, 2026

@fabiobaltieri fabiobaltieri requested a review from a team February 5, 2026 14:24
Copy link
Copy Markdown
Contributor

@tmon-nordic tmon-nordic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know whether this or #103585 is better.

@aescolar
Copy link
Copy Markdown
Member

aescolar commented Feb 5, 2026

I don't see what is the point of adding const to an arithmetic value return.. but you guys in the USB side can decide what you prefer :)

@fabiobaltieri fabiobaltieri deleted the usb-hot branch February 5, 2026 14:39
@fabiobaltieri
Copy link
Copy Markdown
Member Author

I don't see what is the point of adding const to an arithmetic value return

Yeah I've opened this without thinking too much about it, your fix make way more sense.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: USB Universal Serial Bus Hotfix Fix for issues blocking development, i.e. upstream CI issues, tests failing in upstream CI , etc.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants