-
Notifications
You must be signed in to change notification settings - Fork 6.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_dc_nrfx: free memory block if event is intended to be dropped #21244
drivers: usb_dc_nrfx: free memory block if event is intended to be dropped #21244
Conversation
drivers/usb/device/usb_dc_nrfx.c
Outdated
@@ -451,8 +451,12 @@ static inline struct usbd_event *usbd_evt_alloc(void) | |||
|
|||
if (ret < 0) { | |||
LOG_ERR("USBD event allocation failed!"); | |||
if (k_is_in_isr()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could You please provide an explanation for this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It can not be flushed in ISR (in the issue it is usb_dc_nrfx_power_event_callback()). "The kernel does allow an ISR to remove an item from a fifo" from https://docs.zephyrproject.org/latest/reference/kernel/data_passing/fifos.html Oh forget it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I misunderstood something. But flushing did not work here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed it.
Free memory block if event is intended to be dropped. Resolves: zephyrproject-rtos#20953 Signed-off-by: Johann Fischer <[email protected]>
Remove not relevant bashing comments. Signed-off-by: Johann Fischer <[email protected]>
48e068d
to
8781d78
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I accepts this code change as it seems reasonable but from my pov it is fixing the board imperfection as it generates huge amount of unnecessary events what is strange to me.
No, the driver has a issue, it does not free the memory block. This patch fixes this issue, it is not a workaround!!! |
Do not try to flush event queue in ISR.
Free memory block if event is intended to be dropped.
Resolves: #20953