Devicetree
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Esben Haabendal" <esben@geanix.com>
Cc: devicetree@vger.kernel.org, robh@kernel.org, conor+dt@kernel.org
Subject: Re: [PATCH v7 8/8] iio: accel: mma8452: Use proper error code when missing device model
Date: Mon, 31 Aug 2026 12:28:56 +0000	[thread overview]
Message-ID: <20260831122856.BC5821F00A3E@smtp.kernel.org> (raw)
In-Reply-To: <20260831-mma8452-open-drain-v7-8-22946812c928@geanix.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:

Pre-existing issues:
- [High] Pre-existing memory leak of iio_trigger in mma8452_probe error paths.
--

commit 19ad2f8e418619267dc62918b9e4fe522127cae2
Author: Esben Haabendal <esben@geanix.com>

iio: accel: mma8452: Use proper error code when missing device model
    
Switch -ENODEV error on i2c_get_match_data() failure to -ENODATA to
satisfy the IIO coding style.

> diff --git a/drivers/iio/accel/mma8452.c b/drivers/iio/accel/mma8452.c
> index 9619b200fa5a9..9eaced6bf2429 100644
> --- a/drivers/iio/accel/mma8452.c
> +++ b/drivers/iio/accel/mma8452.c
> @@ -1597,7 +1597,7 @@ static int mma8452_probe(struct i2c_client *client)
>  
>  	data->chip_info = i2c_get_match_data(client);
>  	if (!data->chip_info)
> -		return dev_err_probe(dev, -ENODEV, "unknown device model\n");
> +		return dev_err_probe(dev, -ENODATA, "unknown device model\n");
>  
>  	ret = iio_read_mount_matrix(dev, &data->orientation);
>  	if (ret)

[Severity: High]
This isn't a bug introduced by this patch, but there is a pre-existing 
issue in the error handling of mma8452_probe further down in this function.

When mma8452_trigger_setup is called during probe, it elevates the trigger
reference count:

drivers/iio/accel/mma8452.c:mma8452_trigger_setup() {
    ...
    indio_dev->trig = iio_trigger_get(trig);
    ...
}

If a subsequent setup step fails, such as mma8452_set_interrupt_pin_mode,
the code jumps to the cleanup label:

drivers/iio/accel/mma8452.c:mma8452_probe() {
    ...
    ret = mma8452_set_interrupt_pin_mode(data);
    if (ret)
        goto trigger_cleanup;
    ...
}

The error path leaps directly to the final mma8452_trigger_cleanup. Because 
the triggered buffer mode flag is not yet set at the time of failure, the 
IIO core omits bridging cleanup logic and skips the iio_trigger_put call.

Does this result in permanently leaking the trigger device memory?

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260831-mma8452-open-drain-v7-0-22946812c928@geanix.com?part=8

  reply	other threads:[~2026-08-31 12:28 UTC|newest]

Thread overview: 24+ 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
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-09-04 13:41         ` Esben Haabendal
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 [this message]
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=20260831122856.BC5821F00A3E@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