-
Notifications
You must be signed in to change notification settings - Fork 7k
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: usb: device: raspberrypi_pico_usbd - use of uninitialized semaphore #83806
Comments
@FlorianWeber1018 would you be able to send a PR, if you've identified where the missing initialization should happen, maybe? |
@kartben No i am not that used to USB stuff. Thats why i have submitted this issue, hopefully that someone with a more detailed knowledge is looking on that. |
I am not sure how to reproduce it. At least the backtrace would be very helpful. I see the irq_enable() is called too early, @FlorianWeber1018 can you please try #86102 if it fixes your problem. |
@jfischer-no is that what you need? (created with a94acf3 (main) after ~20 reboots) |
@jfischer-no i have tested #86102. It seems to fix this issue. I think there is a high chance that it is fixed now. |
@FlorianWeber1018 As you can see above, the interrupt fires just after irq_enable() in usb_rpi_init(). #86102 should fix it. |
Describe the bug
In some cases the write semaphore is used before it was initialized. This leads to a fatal error.
In my case this happens just after
irq_enable(USB_IRQ); (https://github.com/zephyrproject-rtos/zephyr/blob/main/drivers/usb/device/usb_dc_rpi_pico.c#L1076)
To Reproduce
configure a cdc-acm-uart on the usb device and restart the device (via gdb) till it just happens during boot.
Expected behavior
nothing should use a semaphore before it was initialized.
Environment (please complete the following information):
Additional context
I use the usb interface for a cdc-acm-uart on a raspberryPi pico (rp2040). With the following configured options:
CONFIG_DEBUG=y
CONFIG_DEBUG_OPTIMIZATIONS=y
CONFIG_NO_OPTIMIZATIONS=y
CONFIG_LOG_SPEED=y
and it disappears or seems to happen less frequently if the compiler optimization is enabled.
The text was updated successfully, but these errors were encountered: