From: Peng Fan <peng.fan@oss.nxp.com>
To: sashiko-reviews@lists.linux.dev
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 19:09:41 +0800 [thread overview]
Message-ID: <as4Rdckv0hdCFBqd@shlinux89> (raw)
In-Reply-To: <sashiko-outbox-169085@kernel.org>
On Tue, Oct 13, 2026 at 06:26:06AM +0000, sashiko-bot@kernel.org wrote:
>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:
This is false alarm. __irq_set_trigger() already guard, there is no chance
to 'return -EINVAL' here. The 'return -EINVAL' is just defensive code.
Regards
Peng
>
> 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 11:05 UTC|newest]
Thread overview: 14+ 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 16:51 ` Linus Walleij
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
2026-10-13 11:09 ` Peng Fan [this message]
2026-10-13 16:52 ` Linus Walleij
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=as4Rdckv0hdCFBqd@shlinux89 \
--to=peng.fan@oss.nxp.com \
--cc=Frank.Li@kernel.org \
--cc=imx@lists.linux.dev \
--cc=linux-gpio@vger.kernel.org \
--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