[PATCH 05/10] iio: adc: stm32-adc: Detach chained IRQ handler before removing domain

Fabrice Gasnier fabrice.gasnier at foss.st.com
Fri Nov 20 09:23:19 PST 2026


On 11/19/26 16:30, Lee Jones wrote:
> stm32_adc_irq_remove() disposes of the child IRQ mappings and removes
> priv->domain before clearing the parent chained IRQ handlers.  Because
> the parent hardware interrupt lines remain unmasked while child devices
> use dummy_irq_chip, an interrupt arriving during teardown invokes
> stm32_adc_irq_handler() after irq_domain_remove() has freed
> priv->domain, and irq_set_chained_handler() also leaves handler_data
> dangling.
> 
> Detach the chained handlers and clear handler_data with
> irq_set_chained_handler_and_data() before tearing down the mappings and
> removing the domain.
> 
> Fixes: 1add69880240 ("iio: adc: Add support for STM32 ADC core")
> Closes: https://sashiko.dev/#/bug/linux-27c38690-bc20-43aa-a3fc-1ddd6f1bb74e
> Cc: stable at vger.kernel.org
> Signed-off-by: Lee Jones <lee at kernel.org>
> ---

Hi Lee,

Acked-by: Fabrice Gasnier <fabrice.gasnier at foss.st.com>

Best Regards,
Thanks,
Fabrice

>  drivers/iio/adc/stm32-adc-core.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/iio/adc/stm32-adc-core.c b/drivers/iio/adc/stm32-adc-core.c
> index 4b532db3db62..13b75475046c 100644
> --- a/drivers/iio/adc/stm32-adc-core.c
> +++ b/drivers/iio/adc/stm32-adc-core.c
> @@ -467,12 +467,12 @@ static void stm32_adc_irq_remove(struct platform_device *pdev,
>  	int hwirq;
>  	unsigned int i;
>  
> +	for (i = 0; i < priv->nb_irqs; i++)
> +		irq_set_chained_handler_and_data(priv->irq[i], NULL, NULL);
> +
>  	for (hwirq = 0; hwirq < priv->nb_adc_max; hwirq++)
>  		irq_dispose_mapping(irq_find_mapping(priv->domain, hwirq));
>  	irq_domain_remove(priv->domain);
> -
> -	for (i = 0; i < priv->nb_irqs; i++)
> -		irq_set_chained_handler(priv->irq[i], NULL);
>  }
>  
>  static int stm32_adc_core_switches_supply_en(struct stm32_adc_priv *priv,




More information about the linux-arm-kernel mailing list