From: sashiko-bot@kernel.org
To: "Roman Vivchar" <rva333@protonmail.com>
Cc: devicetree@vger.kernel.org, robh@kernel.org, conor+dt@kernel.org
Subject: Re: [PATCH v5 2/4] iio: adc: mt6323-auxadc: add mt6323 PMIC AUXADC driver
Date: Thu, 09 Jul 2026 11:06:06 +0000 [thread overview]
Message-ID: <20260709110606.BECDB1F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260709-mt6323-adc-v5-2-d11b8332a735@protonmail.com>
Thank you for your contribution! Sashiko AI review found 3 potential issue(s) to consider:
- [High] The driver is unreachable dead code because it is not instantiated by the MFD core.
- [High] Hardware clock is incorrectly powered down during initialization.
- [Medium] Hardware resource leak (power) on PMIC error paths.
--
--- Patch [2]: [PATCH v5 2/4] iio: adc: mt6323-auxadc: add mt6323 PMIC AUXADC driver ---
commit bd09ecf1750ddd84020e392e718056274b3e15a4
Author: Roman Vivchar <rva333@protonmail.com>
iio: adc: mt6323-auxadc: add mt6323 PMIC AUXADC driver
This commit adds a new driver for the AUXADC found in the MediaTek mt6323
PMIC. It provides support for reading various channels including battery
and charger voltages, temperature, and current sensing.
> diff --git a/drivers/iio/adc/mt6323-auxadc.c b/drivers/iio/adc/mt6323-auxadc.c
> new file mode 100644
> index 0000000000000..c450fb6f09cb5
> --- /dev/null
> +++ b/drivers/iio/adc/mt6323-auxadc.c
[ ... ]
> +static int mt6323_auxadc_request(struct mt6323_auxadc *auxadc,
> + unsigned long channel)
> +{
> + struct regmap *map = auxadc->regmap;
> + int ret;
> +
> + ret = regmap_set_bits(map, MT6323_AUXADC_CON11, AUXADC_CON11_VBUF_EN);
> + if (ret)
> + return ret;
> +
> + return regmap_set_bits(map, MT6323_AUXADC_CON22, BIT(channel));
[Severity: Medium]
If regmap_set_bits() for MT6323_AUXADC_CON22 fails here, could this leave
AUXADC_CON11_VBUF_EN permanently enabled?
Since mt6323_auxadc_read_raw() immediately returns without calling
mt6323_auxadc_release() when this function fails, it seems this might cause
a hardware power leak on the error path.
> +}
> +
> +static int mt6323_auxadc_release(struct mt6323_auxadc *auxadc,
> + unsigned long channel)
> +{
> + struct regmap *map = auxadc->regmap;
> + int ret;
> +
> + ret = regmap_clear_bits(map, MT6323_AUXADC_CON22, BIT(channel));
> + if (ret)
> + return ret;
> +
> + return regmap_clear_bits(map, MT6323_AUXADC_CON11, AUXADC_CON11_VBUF_EN);
[Severity: Medium]
Similarly, if clearing MT6323_AUXADC_CON22 fails, will this skip clearing
AUXADC_CON11_VBUF_EN?
> +}
[ ... ]
> +static int mt6323_auxadc_init(struct mt6323_auxadc *auxadc)
> +{
> + struct regmap *map = auxadc->regmap;
> + int ret;
> +
> + ret = regmap_set_bits(map, MT6323_STRUP_CON10,
> + AUXADC_STRUP_CON10_RSTB_SW |
> + AUXADC_STRUP_CON10_RSTB_SEL);
> + if (ret)
> + return ret;
> +
> + ret = regmap_set_bits(map, MT6323_TOP_CKPDN2, AUXADC_TOP_CKPDN2_CTL_CK);
[Severity: High]
Does setting the CKPDN (Clock Power Down) bit disable the clock instead of
enabling it?
In MediaTek PMIC hardware, CKPDN registers usually represent Clock Power
Down, meaning writing a 1 powers down the clock. Should this use
regmap_clear_bits() instead?
> + if (ret)
> + return ret;
[ ... ]
> +static int mt6323_auxadc_probe(struct platform_device *pdev)
> +{
[Severity: High]
Will this probe function ever be executed?
The MT6323 is an MFD device handled by drivers/mfd/mt6397-core.c, which
instantiates its children strictly from the hardcoded mt6323_devs array
using mfd_add_devices().
Since the mt6323-auxadc driver was not added to that array, and the
mediatek,mt6323 PMIC device tree binding does not use simple-mfd, it appears
this driver is structurally unreachable unless the MFD core is also modified.
> + struct device *dev = &pdev->dev;
> + struct mt6323_auxadc *auxadc;
> + struct regmap *regmap;
> + struct iio_dev *iio;
> + int ret;
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260709-mt6323-adc-v5-0-d11b8332a735@protonmail.com?part=2
next prev parent reply other threads:[~2026-07-09 11:06 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-09 10:52 [PATCH v5 0/4] AUXADC driver for the MediaTek mt6323 PMIC Roman Vivchar
2026-07-09 10:52 ` Roman Vivchar via B4 Relay
2026-07-09 10:52 ` [PATCH v5 1/4] dt-bindings: iio: adc: mediatek,mt6359-auxadc: add mt6323 PMIC AUXADC Roman Vivchar
2026-07-09 10:52 ` Roman Vivchar via B4 Relay
2026-07-09 10:52 ` [PATCH v5 2/4] iio: adc: mt6323-auxadc: add mt6323 PMIC AUXADC driver Roman Vivchar
2026-07-09 10:52 ` Roman Vivchar via B4 Relay
2026-07-09 11:06 ` sashiko-bot [this message]
2026-07-10 7:39 ` Uwe Kleine-König
2026-07-10 10:06 ` Roman Vivchar
2026-07-12 1:41 ` Jonathan Cameron
2026-07-09 10:52 ` [PATCH v5 3/4] mfd: mt6397-core: add mt6323 AUXADC support Roman Vivchar
2026-07-09 10:52 ` Roman Vivchar via B4 Relay
2026-07-09 11:04 ` sashiko-bot
2026-07-09 10:52 ` [PATCH v5 4/4] ARM: dts: mediatek: mt6323: add " Roman Vivchar
2026-07-09 10:52 ` Roman Vivchar via B4 Relay
2026-07-09 11:33 ` [PATCH v5 0/4] AUXADC driver for the MediaTek mt6323 PMIC AngeloGioacchino Del Regno
2026-07-09 23:54 ` Jonathan Cameron
2026-07-13 8:11 ` AngeloGioacchino Del Regno
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=20260709110606.BECDB1F000E9@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=robh@kernel.org \
--cc=rva333@protonmail.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.