[PATCH v4 0/3] iio: adc: at91_adc: fix trigger NULL deref and convert to devm_*

From: Abdelnasser Hussein

Date: Tue Nov 17 2026 - 09:05:41 EST


This series fixes a NULL pointer dereference in at91_adc when external
triggers are absent from the Device Tree, and converts
the driver to devm_* APIs.

The series is split
into three patches:
1.NULL-pointer fix.
2.introduce a local 'struct device *dev' and use sizeof(*st) in probe().
3.removing manual cleanup and inlining trigger
and buffer setup helpers into probe().

Changes in v4:
- Split v3 into three patches (Joshua Crofts, Jonathan Cameron).
- Patch 1:NULL check.
- Patch 2: Separate the local 'dev' pointer introduction and sizeof(*st)
change (Jonathan Cameron).
- Patch 3:
- Remove at91_adc_allocate_trigger() and at91_adc_buffer_init(),
inline their logic in probe(), and avoid relying on idev->dev.parent
(Jonathan Cameron).
- Remove redundant dev_err() on trigger allocation -ENOMEM
(Jonathan Cameron).
- Use dev_err_probe() in at91_ts_register() and for
devm_iio_device_register() failures in probe() (Jonathan Cameron).

Changes in v3:
- Remove redundant dev_err() after devm_input_allocate_device()
(Andy Shevchenko).
- Introduce local 'struct device *dev = &pdev->dev' in probe()
(Andy Shevchenko).
- Declare the loop iterator inside the for-loop.

Changes in v2:
- Replace the simple NULL check with a full devm_* conversion,
as suggested by Jonathan Cameron.

Abdelnasser Hussein (3):
iio: adc: at91_adc: fix NULL pointer dereference on trigger remove
iio: adc: at91_adc: use local struct device pointer in probe
iio: adc: at91_adc: convert to device-managed resources

drivers/iio/adc/at91_adc.c | 229 ++++++++++---------------------------
1 file changed, 62 insertions(+), 167 deletions(-)

--
2.56.0