From: sashiko-bot@kernel.org
To: "Peng Fan (OSS)" <peng.fan@oss.nxp.com>
Cc: linux-gpio@vger.kernel.org, imx@lists.linux.dev, Frank.Li@kernel.org
Subject: Re: [PATCH v7 2/4] gpio: mxc: fix both_edges bit operations
Date: Tue, 13 Oct 2026 06:26:06 +0000 [thread overview]
Message-ID: <sashiko-outbox-169085@kernel.org> (raw)
In-Reply-To: <20261013-gpio-mxc-cleanup-v7-2-c4d769587d3e@nxp.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] gpio: state corruption on error path in gpio_set_irq_type()
--
commit 3d5872f9d45fab5b313d49ded5e6a9aacb019069
Author: Peng Fan <peng.fan@nxp.com>
gpio: mxc: fix both_edges bit operations
This commit converts both_edges from u32 to unsigned long and uses atomic
bitops to prevent concurrent updates from overwriting each other.
> diff --git a/drivers/gpio/gpio-mxc.c b/drivers/gpio/gpio-mxc.c
> index e05f276a50e8d..7e17d7668980d 100644
> --- a/drivers/gpio/gpio-mxc.c
> +++ b/drivers/gpio/gpio-mxc.c
[ ... ]
> @@ -168,7 +169,7 @@ static int gpio_set_irq_type(struct irq_data *d, u32 type)
> int edge;
> void __iomem *reg = port->base;
>
> - port->both_edges &= ~(1 << gpio_idx);
> + clear_bit(gpio_idx, &port->both_edges);
[Severity: Medium]
If a caller requests an unsupported IRQ type, the switch statement later in
this function falls through to the default case and returns -EINVAL:
switch (type) {
...
default:
return -EINVAL;
}
Could clearing both_edges early here leave the software state desynchronized
from the hardware on this error path?
If the hardware was previously configured for dual-edge interrupts, test_bit()
in the IRQ handler will now return false, failing to flip the edge and
potentially leading to a stuck IRQ line or interrupt storm.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261013-gpio-mxc-cleanup-v7-0-c4d769587d3e@nxp.com?part=2
next prev parent reply other threads:[~2026-10-13 6:26 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-13 6:01 [PATCH v7 0/4] gpio: mxc: misc bug fixes Peng Fan (OSS)
2026-10-13 6:01 ` [PATCH v7 1/4] gpio: mxc: fix race between chained IRQ handler install and probe completion Peng Fan (OSS)
2026-10-13 6:01 ` [PATCH v7 2/4] gpio: mxc: fix both_edges bit operations Peng Fan (OSS)
2026-10-13 6:26 ` sashiko-bot [this message]
2026-10-13 11:09 ` Peng Fan
2026-10-13 6:01 ` [PATCH v7 3/4] gpio: mxc: fix wakeup_pads " Peng Fan (OSS)
2026-10-13 6:35 ` sashiko-bot
2026-10-13 11:11 ` Peng Fan
2026-10-13 10:33 ` Andy Shevchenko
2026-10-13 6:01 ` [PATCH v7 4/4] gpio: mxc: fix race between gpiochip registration and IRQ domain setup Peng Fan (OSS)
2026-10-13 14:29 ` Frank Li
2026-10-13 10:35 ` [PATCH v7 0/4] gpio: mxc: misc bug fixes Andy Shevchenko
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=sashiko-outbox-169085@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=Frank.Li@kernel.org \
--cc=imx@lists.linux.dev \
--cc=linux-gpio@vger.kernel.org \
--cc=peng.fan@oss.nxp.com \
--cc=sashiko-reviews@lists.linux.dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox