[PATCH v6 1/8] iio: adc: at91_adc: skip unpopulated triggers on teardown
Andy Shevchenko
andriy.shevchenko at intel.com
Thu Dec 3 09:53:23 PST 2026
On Thu, Dec 03, 2026 at 07:30:05PM +0200, Abdelnasser Hussein wrote:
> at91_adc_trigger_init() and at91_adc_trigger_remove() iterate over all
> st->trig entries. External trigger slots remain NULL when
> "atmel,adc-use-external-triggers" is absent, so skip them in both
> teardown loops.
>
> Keep this as a minimal stable-backportable fix; the devm conversion later
> in the series removes this teardown code.
...
> error_trigger:
> for (i--; i >= 0; i--) {
> + /*
> + * iio_trigger_unregister() is intentionally not NULL-aware so
> + * unregistering an unallocated trigger fails loudly.
> + */
No, this comment should be in the kernel-doc for iio_trigger_unregister().
> + if (!st->trig[i])
> + continue;
Then it will automatically explains this check.
> iio_trigger_unregister(st->trig[i]);
> iio_trigger_free(st->trig[i]);
> }
...
> for (i = 0; i < st->caps->trigger_number; i++) {
> + /*
> + * iio_trigger_unregister() is intentionally not NULL-aware so
> + * unregistering an unallocated trigger fails loudly.
> + */
> + if (!st->trig[i])
> + continue;
> +
> iio_trigger_unregister(st->trig[i]);
> iio_trigger_free(st->trig[i]);
> }
Same here.
--
With Best Regards,
Andy Shevchenko
More information about the linux-arm-kernel
mailing list