Re: [PATCH v3] iio: adc: stm32-adc: fix check on internal channel availability

From: Jonathan Cameron

Date: Sun Sep 20 2026 - 20:15:00 EST


On Wed, 16 Sep 2026 19:18:38 +0200
Fabrice Gasnier <fabrice.gasnier@xxxxxxxxxxx> wrote:

> If an unsupported internal channel like vddgpu is requested, the driver
> prints a warning but falls through and assigns it a valid int_ch below.
>
> This causes a problem later during setup:
> stm32_adc_int_ch_enable() {
> ...
> case STM32_ADC_INT_CH_VDDGPU:
> stm32_adc_set_bits(adc, adc->cfg->regs->or_vddgpu.reg,
> adc->cfg->regs->or_vddgpu.mask);
> ...
> }
>
> Because the register offset is uninitialized (0), this performs a
> read-modify-write on offset 0, which corresponds to the ISR register.
>
> Fix this by returning before a valid int_ch is assigned. Choice is
> made to keep current driver behavior to warn about the channel name.
>
> Fixes: cf0fb80ae167 ("iio: adc: stm32-adc: add stm32mp13 support")
> Reported-by: Sashiko <sashiko-bot@xxxxxxxxxx>
> Closes: https://lore.kernel.org/all/20260911162602.D323F1F000FF@xxxxxxxxxxxxxxx/
> Cc: stable@xxxxxxxxxxxxxxx
> Reviewed-by: Andy Shevchenko <andriy.shevchenko@xxxxxxxxx>
> Signed-off-by: Fabrice Gasnier <fabrice.gasnier@xxxxxxxxxxx>
Applied to the fixes-togreg branch of iio.git.

Thanks,

Jonathan