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

Invalid pin reported in gpio callback #24634

Closed
pdunaj opened this issue Apr 23, 2020 · 0 comments · Fixed by #24640
Closed

Invalid pin reported in gpio callback #24634

pdunaj opened this issue Apr 23, 2020 · 0 comments · Fixed by #24640
Labels
area: GPIO bug The issue is a bug, or the PR is fixing a bug platform: nRF Nordic nRFx

Comments

@pdunaj
Copy link
Collaborator

pdunaj commented Apr 23, 2020

Describe the bug
The fire_callbacks in gpio_nrfx.c is suppose to notify connected functions that interrupt happened on the GPIO they observe.
There is a bug there - when callback if fired it informs the linked function about all pins that have active isr at the time. In our code we use this information to disable the isr lines for specific pins. Since we can get information about some random pin we may disable callback that somebody else is waiting for.

                if ((cb->pin_mask & pins) & data->int_en) {                                                              
                        __ASSERT(cb->handler, "No callback handler!");                                                   
                        cb->handler(port, cb, pins);                                                                     
                }

the above code should have

                        cb->handler(port, cb, cb->pin_mask & pins);

To Reproduce
Setup two gpio callbacks, one for each pin.

Expected behavior
When callback is fired it should get information about pins it is connected to.

Impact
Showstopper.

Screenshots or console output
N/A

Environment (please complete the following information):
master

Additional context
N/A

@pdunaj pdunaj added bug The issue is a bug, or the PR is fixing a bug area: GPIO platform: nRF Nordic nRFx labels Apr 23, 2020
pdunaj added a commit to pdunaj/zephyr that referenced this issue Apr 24, 2020
When notifying the handler that GPIO interrupt has occurred
pass only pins that are associated with this handler.

Fixes: zephyrproject-rtos#24634

Signed-off-by: Pawel Dunaj <pawel.dunaj@nordicsemi.no>
carlescufi pushed a commit that referenced this issue Apr 24, 2020
When notifying the handler that GPIO interrupt has occurred
pass only pins that are associated with this handler.

Fixes: #24634

Signed-off-by: Pawel Dunaj <pawel.dunaj@nordicsemi.no>
sandeepbrcm pushed a commit to Broadcom/zephyr that referenced this issue Apr 30, 2020
When notifying the handler that GPIO interrupt has occurred
pass only pins that are associated with this handler.

Fixes: zephyrproject-rtos#24634

Signed-off-by: Pawel Dunaj <pawel.dunaj@nordicsemi.no>
hakehuang pushed a commit to hakehuang/zephyr that referenced this issue Jun 20, 2020
When notifying the handler that GPIO interrupt has occurred
pass only pins that are associated with this handler.

Fixes: zephyrproject-rtos#24634

Signed-off-by: Pawel Dunaj <pawel.dunaj@nordicsemi.no>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: GPIO bug The issue is a bug, or the PR is fixing a bug platform: nRF Nordic nRFx
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant