Skip to content

drivers: misc: fix condition in gpio_ra_interrupt_unset function #91231

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

Merged
merged 1 commit into from
Jun 17, 2025

Conversation

kartben
Copy link
Contributor

@kartben kartben commented Jun 7, 2025

Updated the condition in the gpio_ra_interrupt_unset function to use a logical OR instead of AND, since it should return if either port_num or pin is not the same as the current callback.

Updated the condition in the gpio_ra_interrupt_unset function to use a
logical OR instead of AND, since it should return if either port_num or
pin is not the same as the current callback.

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
Copy link

sonarqubecloud bot commented Jun 7, 2025

@kartben kartben marked this pull request as ready for review June 7, 2025 19:45
@github-actions github-actions bot added the size: XS A PR changing only a single line of code label Jun 7, 2025
@kartben kartben requested review from soburi and fabiobaltieri June 10, 2025 10:57
@kartben kartben added the Trivial Changes that can be reviewed by anyone, i.e. doc changes, minor build system tweaks, etc. label Jun 10, 2025
@kartben kartben requested a review from KhiemNguyenT June 10, 2025 10:59
@@ -107,7 +107,7 @@ void gpio_ra_interrupt_unset(const struct device *dev, uint8_t port_num, uint8_t
const struct gpio_ra_irq_config *config = dev->config;
struct gpio_ra_irq_data *data = dev->data;

if ((port_num != data->callback.port_num) && (pin != data->callback.pin)) {
if ((port_num != data->callback.port_num) || (pin != data->callback.pin)) {
Copy link
Member

@fabiobaltieri fabiobaltieri Jun 10, 2025

Choose a reason for hiding this comment

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

I think it'd be logically easier to understand if it was written as

if (!((port_num == data->callback.port_num) && (pin == data->callback.pin))) {

may be just me though... up to you

@kartben kartben merged commit 1787e5c into zephyrproject-rtos:main Jun 17, 2025
30 checks passed
@kartben kartben deleted the ra_extint branch June 17, 2025 07:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
size: XS A PR changing only a single line of code Trivial Changes that can be reviewed by anyone, i.e. doc changes, minor build system tweaks, etc.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants