Re: [PATCH v5 1/8] iio: adc: at91_adc: skip unpopulated triggers on teardown

From: Joshua Crofts

Date: Mon Nov 23 2026 - 02:53:48 EST


On 23-Nov-26 8:00, Abdelnasser Hussein wrote:
> The driver keeps an array of triggers and leaves the slots for external
> triggers unpopulated (NULL) when the "atmel,adc-use-external-triggers"
> property is not set. Both the error rollback path in
> at91_adc_trigger_init() and at91_adc_trigger_remove() walk the whole
> array and call iio_trigger_unregister() and iio_trigger_free() on every
> entry, including the empty ones, which dereferences NULL.
>
> Skip unpopulated trigger slots in both loops.
>
> Make a minimal fix to simplify backporting. Moving over to device managed
> cleanup will shortly remove this code.
>
> Fixes: 0e589d5fb317 ("ARM: AT91: IIO: Add AT91 ADC driver.")
> Cc: stable@xxxxxxxxxxxxxxx
> Signed-off-by: Abdelnasser Hussein <abdelnasserhussein11@xxxxxxxxx>
> ---
Reviewed-by: Joshua Crofts <crofts@xxxxxxxxxx>

--
Kind regards,
Joshua Crofts