Devicetree
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Ryan Brue" <ryanbrue.dev@gmail.com>
Cc: lee@kernel.org, devicetree@vger.kernel.org, mfd@lists.linux.dev,
	robh@kernel.org, conor+dt@kernel.org
Subject: Re: [PATCH v3 2/3] iio: adc: mt6397-auxadc: add mt6397 PMIC AUXADC driver
Date: Sun, 20 Sep 2026 05:49:50 +0000	[thread overview]
Message-ID: <20260920054950.9A94E1F000FF@smtp.kernel.org> (raw)
In-Reply-To: <20260920-rbrue-suez-upstreaming-mt6397-auxadc-v3-2-c00edacbee64@gmail.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] iio: adc: early return on regmap error abandons hardware teardown
--

commit 7889b991ac3807eea04917eed3e7986efc9451b3
Author: Ryan Brue <ryanbrue.dev@gmail.com>

iio: adc: mt6397-auxadc: add mt6397 PMIC AUXADC driver
    
The mt6397 AUXADC is a 10-bit ADC behind the SoC's PMIC wrapper. On boards
built around this PMIC it is the only way to read the battery. Add a driver
exposing the battery voltage and battery temperature channels.

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

[ ... ]

> +static int mt6397_auxadc_battemp_bias_off(struct mt6397_auxadc *adc)
> +{
> +	struct regmap *map = adc->regmap;
> +	int ret;
> +
> +	ret = regmap_clear_bits(map, MT6397_CHR_CON7, MT6397_CHR_CON7_BATON_TDET_EN);
> +	if (ret)
> +		return ret;
> +
> +	ret = regmap_clear_bits(map, MT6397_AUXADC_CON0, MT6397_AUXADC_CON0_BUF_PWD_B);
> +	if (ret)
> +		return ret;
> +
> +	return regmap_clear_bits(map, MT6397_AUXADC_CON0,
> +				 MT6397_AUXADC_CON0_BUF_PWD_ON);
> +}

[Severity: Medium]
Does returning early here abandon the hardware teardown? If clearing
MT6397_CHR_CON7 fails, the MT6397_AUXADC_CON0 bias buffers will remain
enabled. Since the caller relies on this function to provide unconditional
teardown even if earlier steps failed, should this function continue and
attempt to clear the remaining bits regardless of an error?

[ ... ]

> +static int mt6397_auxadc_isense_disable(struct mt6397_auxadc *adc)
> +{
> +	struct regmap *map = adc->regmap;
> +	int ret;
> +
> +	ret = regmap_clear_bits(map, MT6397_AUXADC_CON14,
> +				MT6397_AUXADC_CON14_CH0_NORM_SEL |
> +				MT6397_AUXADC_CON14_CH0_LBAT_SEL);
> +	if (ret)
> +		return ret;
> +
> +	return regmap_clear_bits(map, MT6397_CHR_CON16,
> +				 MT6397_CHR_CON16_ADCIN_VSEN_EN |
> +				 MT6397_CHR_CON16_ADCIN_VBAT_EN);
> +}

[Severity: Medium]
Similarly, does returning early here prevent MT6397_CHR_CON16 from being
cleared if updating MT6397_AUXADC_CON14 fails?

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

  reply	other threads:[~2026-09-20  5:49 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-20  5:31 [PATCH v3 0/3] iio: adc: add mt6397 PMIC AUXADC support Ryan Brue
2026-09-20  5:31 ` [PATCH v3 1/3] dt-bindings: iio: adc: mediatek,mt6359-auxadc: add mt6397 PMIC AUXADC Ryan Brue
2026-09-20  5:42   ` sashiko-bot
2026-09-21 10:16   ` AngeloGioacchino Del Regno
2026-09-24 12:06   ` Krzysztof Kozlowski
2026-09-20  5:31 ` [PATCH v3 2/3] iio: adc: mt6397-auxadc: add mt6397 PMIC AUXADC driver Ryan Brue
2026-09-20  5:49   ` sashiko-bot [this message]
2026-09-21 10:15   ` AngeloGioacchino Del Regno
2026-09-25  2:04   ` Jonathan Cameron
2026-09-20  5:31 ` [PATCH v3 3/3] mfd: mt6397-core: Add mt6397 AUXADC support Ryan Brue
2026-09-20  5:54   ` sashiko-bot
2026-09-21 10:16   ` AngeloGioacchino Del Regno
2026-09-20 23:17 ` [PATCH v3 0/3] iio: adc: add mt6397 PMIC " Jonathan Cameron
2026-09-21  0:22   ` 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=20260920054950.9A94E1F000FF@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