From: sashiko-bot@kernel.org
To: "Esben Haabendal" <esben@geanix.com>
Cc: robh@kernel.org, conor+dt@kernel.org, devicetree@vger.kernel.org
Subject: Re: [PATCH v7 3/8] iio: accel: mma8452: Only apply trigger type when not set by firmware
Date: Mon, 31 Aug 2026 12:32:34 +0000 [thread overview]
Message-ID: <20260831123235.466E81F00A3D@smtp.kernel.org> (raw)
In-Reply-To: <20260831-mma8452-open-drain-v7-3-22946812c928@geanix.com>
Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
New issues:
- [High] Hardware Configuration Mismatch for Interrupt Trigger Type
Pre-existing issues:
- [High] Unbalanced regulator disables and unpowered I2C access on driver remove if runtime PM is suspended
--
commit 4e5790a8b828438ae278194b6cc6f95e4fa39c50
Author: Esben Haabendal <esben@geanix.com>
iio: accel: mma8452: Only apply trigger type when not set by firmware
Instead of unconditionally overriding the trigger type, it is better to
only apply a default when no trigger type is set by firmware. This should
be reasonably backward compatible, and should only potentially cause
problems if systems exist where firmware specifies an incorrect trigger type.
> diff --git a/drivers/iio/accel/mma8452.c b/drivers/iio/accel/mma8452.c
> index f645a5c6fd1c2..1fb43c5b0b72f 100644
> --- a/drivers/iio/accel/mma8452.c
> +++ b/drivers/iio/accel/mma8452.c
> @@ -1683,9 +1683,16 @@ static int mma8452_probe(struct i2c_client *client)
> goto trigger_cleanup;
>
> if (client->irq) {
> + unsigned long irq_flags;
> +
> + irq_flags = irq_get_trigger_type(client->irq);
> + if (irq_flags == IRQ_TYPE_NONE) {
> + dev_info(dev, "invalid irq type, setting default active low\n");
> + irq_flags = IRQF_TRIGGER_LOW;
> + }
> + irq_flags |= IRQF_ONESHOT;
> ret = request_threaded_irq(client->irq, NULL, mma8452_interrupt,
> - IRQF_TRIGGER_LOW | IRQF_ONESHOT,
> - client->name, indio_dev);
[Severity: High]
Does this code configure the sensor's hardware polarity to match the requested
trigger type?
If the firmware configures the interrupt with an active-high trigger (such as
IRQ_TYPE_LEVEL_HIGH), the patch reads this via irq_get_trigger_type() and
requests the interrupt from the host controller using this flag. However, the
driver never sets the IPOL bit (Interrupt Polarity, bit 1 of CTRL_REG3) to
match this configuration.
Since the sensor remains in its default active-low state, can this hardware
configuration mismatch result in the interrupt signal going unrecognized or
causing an interrupt storm on systems with an active-high trigger?
While reviewing this, I also noticed a pre-existing issue in mma8452_remove():
drivers/iio/accel/mma8452.c:mma8452_remove() {
...
pm_runtime_disable(&client->dev);
pm_runtime_set_suspended(&client->dev);
if (client->irq)
free_irq(client->irq, indio_dev);
iio_triggered_buffer_cleanup(indio_dev);
mma8452_trigger_cleanup(indio_dev);
mma8452_standby(iio_priv(indio_dev));
regulator_disable(data->vddio_reg);
regulator_disable(data->vdd_reg);
}
[Severity: High]
This is a pre-existing issue, but can this cause a regulator enable count
underflow and I2C timeouts?
If the module is removed while the device is in a runtime-suspended state
(where mma8452_runtime_suspend() has already disabled both regulators),
mma8452_remove() calls pm_runtime_disable() which does not resume the device.
It then calls mma8452_standby(), which performs I2C writes to the unpowered
device, and unconditionally disables the regulators again, causing an underflow.
Is there a way to ensure the device is woken up or the regulator states are
checked before proceeding with removal?
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260831-mma8452-open-drain-v7-0-22946812c928@geanix.com?part=3
next prev parent reply other threads:[~2026-08-31 12:32 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-31 12:17 [PATCH v7 0/8] io: accel: mma8452: Allow open drain interrupt pin configuration Esben Haabendal
2026-08-31 12:17 ` [PATCH v7 1/8] dt-bindings: iio: accel: mma8452: Add drive-open-drain Esben Haabendal
2026-08-31 12:17 ` [PATCH v7 2/8] iio: accel: mma8452: Optimize struct mma8452_data member orders Esben Haabendal
2026-08-31 12:17 ` [PATCH v7 3/8] iio: accel: mma8452: Only apply trigger type when not set by firmware Esben Haabendal
2026-08-31 12:32 ` sashiko-bot [this message]
2026-08-31 12:17 ` [PATCH v7 4/8] iio: accel: mma8452: Support interrupt sharing Esben Haabendal
2026-08-31 12:30 ` sashiko-bot
2026-08-31 13:56 ` Andy Shevchenko
2026-08-31 15:43 ` Esben Haabendal
2026-09-01 7:13 ` Andy Shevchenko
2026-08-31 12:17 ` [PATCH v7 5/8] iio: accel: mma8452: Allow open drain interrupt pin configuration Esben Haabendal
2026-08-31 12:32 ` sashiko-bot
2026-08-31 12:17 ` [PATCH v7 6/8] iio: accel: mma8452: Reuse existing dev pointer in mma8452_probe() Esben Haabendal
2026-08-31 13:58 ` Andy Shevchenko
2026-08-31 12:17 ` [PATCH v7 7/8] iio: accel: mma8452: Fix use-after-free bug in error error path Esben Haabendal
2026-08-31 12:31 ` sashiko-bot
2026-08-31 13:09 ` Joshua Crofts
2026-08-31 14:00 ` Andy Shevchenko
2026-08-31 15:47 ` Esben Haabendal
2026-08-31 12:17 ` [PATCH v7 8/8] iio: accel: mma8452: Use proper error code when missing device model Esben Haabendal
2026-08-31 12:28 ` sashiko-bot
2026-08-31 15:48 ` Esben Haabendal
2026-08-31 13:59 ` 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=20260831123235.466E81F00A3D@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=esben@geanix.com \
--cc=robh@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