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: usb_dc_nrfx: free memory block if event is intended to be dropped #21244

Merged

Conversation

jfischer-no
Copy link
Collaborator

Do not try to flush event queue in ISR.
Free memory block if event is intended to be dropped.
Resolves: #20953

@jfischer-no jfischer-no added bug The issue is a bug, or the PR is fixing a bug area: Drivers area: USB Universal Serial Bus platform: nRF Nordic nRFx labels Dec 9, 2019
@@ -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()) {
Copy link
Collaborator

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?

Copy link
Collaborator Author

@jfischer-no jfischer-no Dec 9, 2019

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.

Copy link
Collaborator Author

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.

Copy link
Collaborator Author

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]>
Copy link
Collaborator

@eobalski eobalski left a 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.

@jfischer-no
Copy link
Collaborator Author

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!!!

@carlescufi carlescufi merged commit 9a7a1b0 into zephyrproject-rtos:master Dec 11, 2019
@jfischer-no jfischer-no deleted the pr-fix-pwr_event-usb_dc_nrfx branch December 11, 2019 17:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: Drivers area: USB Universal Serial Bus bug The issue is a bug, or the PR is fixing a bug platform: nRF Nordic nRFx
Projects
None yet
Development

Successfully merging this pull request may close these issues.

usb: nrf: usb on reel board becomes unavailable if USB cable is not connected at first
3 participants