Devicetree
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Ryan Brue" <ryanbrue.dev@gmail.com>
Cc: conor+dt@kernel.org, mfd@lists.linux.dev, robh@kernel.org,
	devicetree@vger.kernel.org, lee@kernel.org
Subject: Re: [PATCH v2 2/3] iio: adc: mt6397-auxadc: add mt6397 PMIC AUXADC driver
Date: Fri, 18 Sep 2026 02:27:13 +0000	[thread overview]
Message-ID: <20260918022714.1B1591F00893@smtp.kernel.org> (raw)
In-Reply-To: <20260917-rbrue-suez-upstreaming-mt6397-auxadc-v2-2-db35882a6080@gmail.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Low] cleanup: mixing guard() with goto-based error handling
--

commit 87915e91ec3452c12fe08ad4408b6e74876dc5ef
Author: Ryan Brue <ryanbrue.dev@gmail.com>

iio: adc: mt6397-auxadc: add mt6397 PMIC AUXADC driver

This commit introduces a new driver for the mt6397 PMIC AUXADC, exposing the
battery voltage and temperature channels. It implements custom software
averaging and handles the specific channel selection and start requirements
for this PMIC variant.

> diff --git a/drivers/iio/adc/mt6397-auxadc.c b/drivers/iio/adc/mt6397-auxadc.c
> new file mode 100644
> index 0000000000000..2f602e16e4f0f
> --- /dev/null
> +++ b/drivers/iio/adc/mt6397-auxadc.c

[ ... ]

> +static int mt6397_auxadc_read_channel(struct mt6397_auxadc *adc,
> +				      const struct iio_chan_spec *chan,
> +				      int *val)
> +{
> +	bool isense = chan->channel == MT6397_AUXADC_ISENSE;
> +	unsigned int sum = 0;
> +	int sample;
> +	int ret;
> +
> +	/* Held across the whole burst: the channel select is shared state. */
> +	guard(mutex)(&adc->lock);
> +
> +	/*
> +	 * Once any part of the per-channel setup has been written, the
> +	 * teardown has to run, so every exit below goes through it.
> +	 */
> +	if (isense) {
> +		ret = mt6397_auxadc_isense_enable(adc);
> +		if (ret)
> +			goto out_teardown;

[Severity: Low]
Does this mix scope-based guard() for locking with goto-based error handling
in mt6397_auxadc_read_channel()?

While this might not cause a direct functional bug in this exact instance 
since the lock is held across the entire function scope and released
correctly, it explicitly violates the kernel cleanup subsystem rules in
include/linux/cleanup.h.

The cleanup guidelines mandate that goto and cleanup helpers should never be
mixed in the same function to avoid introducing an anti-pattern that creates
confusing ownership semantics.

[ ... ]

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260917-rbrue-suez-upstreaming-mt6397-auxadc-v2-0-db35882a6080@gmail.com?part=2

  reply	other threads:[~2026-09-18  2:27 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-18  2:19 [PATCH v2 0/3] iio: adc: add mt6397 PMIC AUXADC support Ryan Brue
2026-09-18  2:19 ` [PATCH v2 1/3] dt-bindings: iio: adc: mediatek,mt6359-auxadc: add mt6397 PMIC AUXADC Ryan Brue
2026-09-18  2:25   ` sashiko-bot
2026-09-18  2:19 ` [PATCH v2 2/3] iio: adc: mt6397-auxadc: add mt6397 PMIC AUXADC driver Ryan Brue
2026-09-18  2:27   ` sashiko-bot [this message]
2026-09-18  2:44     ` Ryan Brue
2026-09-18  7:31   ` Andy Shevchenko
2026-09-20  2:48     ` Ryan Brue
2026-09-18  2:19 ` [PATCH v2 3/3] mfd: mt6397-core: Add mt6397 AUXADC support Ryan Brue
2026-09-18  2:28   ` sashiko-bot
2026-09-18  7:18 ` [PATCH v2 0/3] iio: adc: add mt6397 PMIC " Andy Shevchenko
2026-09-20  5:18   ` Ryan Brue

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=20260918022714.1B1591F00893@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=lee@kernel.org \
    --cc=mfd@lists.linux.dev \
    --cc=robh@kernel.org \
    --cc=ryanbrue.dev@gmail.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