From: Abdelnasser Hussein <abdelnasserhussein11@gmail.com>
To: jic23@kernel.org, linux-iio@vger.kernel.org
Cc: dlechner@baylibre.com, nuno.sa@analog.com, andy@kernel.org,
nicolas.ferre@microchip.com, alexandre.belloni@bootlin.com,
claudiu.beznea@tuxon.dev, giorgitchankvetadze1997@gmail.com,
amin.gattout@gmail.com, antoniu.miclaus@analog.com,
gregkh@linuxfoundation.org, mripard@kernel.org,
linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org,
Abdelnasser Hussein <abdelnasserhussein11@gmail.com>
Subject: [PATCH v5 0/8] iio: adc: at91_adc: fix NULL trigger dereference and convert to devm
Date: Mon, 23 Nov 2026 09:00:53 +0200 [thread overview]
Message-ID: <20261123070101.53868-1-abdelnasserhussein11@gmail.com> (raw)
This series fixes a NULL pointer dereference during trigger teardown in
at91_adc and modernizes the driver to use firmware-agnostic property
APIs and device-managed (devm) resources.
When the "atmel,adc-use-external-triggers" property is omitted from the
Device Tree, at91_adc_trigger_init() leaves external trigger slots in
st->trig as NULL. Patch 1 provides a minimal fix in at91_adc for easy
backporting to stable kernels, while the subsequent patches modernize
the driver and convert it to devm_* APIs (removing the manual teardown
code and the st->trig array altogether).
Changes in v5:
- Patch 1: Keep the minimal NULL check in at91_adc instead of modifying
iio_trigger_unregister(), and explicitly note in the commit message
that it is a minimal fix for backporting before devm removal (as
requested by Jonathan Cameron).
- Patch 2: Drop the redundant dev_err_probe() message after
devm_request_irq() in a separate patch.
- Patch 3: Switch from of_device_get_match_data() to
device_get_match_data() and check for NULL in a separate patch.
- Patch 4: Convert of_property_*() calls in at91_adc_probe() and
at91_adc_probe_dt_ts() (renamed to at91_adc_probe_ts()) to
device_property_*() APIs, removing the local device_node pointer and
dropping "in the DT" from missing-property logs. Since no OF APIs
remain, replace <linux/of.h> with <linux/mod_devicetable.h>.
- Patch 5: Introduce local struct device *dev in at91_adc_probe() and
switch devm_iio_device_alloc() to sizeof(*st).
- Patch 6: Pass struct device *dev instead of struct platform_device *pdev
to at91_ts_register() in a separate patch.
- Patch 7: Replace raw 1000 with HZ_PER_KHZ from <linux/units.h>.
- Patch 8: Convert the remaining buffer, trigger, touchscreen input, and
IIO device registrations to devm_* APIs, use unsigned int for the
trigger loop index, drop the now-unused st->trig array, drop the
redundant input->dev.parent assignment, and remove at91_adc_remove().
Changes in v4:
- Split the series into 3 atomic patches: (1) standalone NULL trigger
teardown fix for stable backporting, (2) local struct device pointer
cleanup, and (3) full devm_* conversion.
Changes in v3:
- Address review feedback from Andy Shevchenko on v2 (drop redundant
-ENOMEM log, use local struct device pointer, scope loop index to the
for-loop, and convert error paths to dev_err_probe()).
Changes in v2:
- Drop the simple NULL check approach from v1 and refactor the driver to
use device-managed (devm_*) APIs as suggested by Jonathan Cameron,
removing manual cleanup functions and at91_adc_remove(), and inlining
trigger initialization into at91_adc_probe().
Abdelnasser Hussein (8):
iio: adc: at91_adc: skip unpopulated triggers on teardown
iio: adc: at91_adc: drop duplicate IRQ allocation error message
iio: adc: at91_adc: switch to device_get_match_data()
iio: adc: at91_adc: convert to device_property_*() APIs
iio: adc: at91_adc: use local struct device pointer in probe
iio: adc: at91_adc: pass struct device to at91_ts_register()
iio: adc: at91_adc: use HZ_PER_KHZ instead of raw 1000
iio: adc: at91_adc: convert to device-managed resources
drivers/iio/adc/at91_adc.c | 266 +++++++++++--------------------------
1 file changed, 77 insertions(+), 189 deletions(-)
--
2.56.0
next reply other threads:[~2026-11-23 7:03 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-23 7:00 Abdelnasser Hussein [this message]
2026-11-23 7:00 ` [PATCH v5 1/8] iio: adc: at91_adc: skip unpopulated triggers on teardown Abdelnasser Hussein
2026-11-23 7:00 ` [PATCH v5 2/8] iio: adc: at91_adc: drop duplicate IRQ allocation error message Abdelnasser Hussein
2026-11-23 7:00 ` [PATCH v5 3/8] iio: adc: at91_adc: switch to device_get_match_data() Abdelnasser Hussein
2026-11-23 7:00 ` [PATCH v5 4/8] iio: adc: at91_adc: convert to device_property_*() APIs Abdelnasser Hussein
2026-11-23 7:00 ` [PATCH v5 5/8] iio: adc: at91_adc: use local struct device pointer in probe Abdelnasser Hussein
2026-11-23 7:00 ` [PATCH v5 6/8] iio: adc: at91_adc: pass struct device to at91_ts_register() Abdelnasser Hussein
2026-11-23 7:01 ` [PATCH v5 7/8] iio: adc: at91_adc: use HZ_PER_KHZ instead of raw 1000 Abdelnasser Hussein
2026-11-23 7:01 ` [PATCH v5 8/8] iio: adc: at91_adc: convert to device-managed resources Abdelnasser Hussein
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261123070101.53868-1-abdelnasserhussein11@gmail.com \
--to=abdelnasserhussein11@gmail.com \
--cc=alexandre.belloni@bootlin.com \
--cc=amin.gattout@gmail.com \
--cc=andy@kernel.org \
--cc=antoniu.miclaus@analog.com \
--cc=claudiu.beznea@tuxon.dev \
--cc=dlechner@baylibre.com \
--cc=giorgitchankvetadze1997@gmail.com \
--cc=gregkh@linuxfoundation.org \
--cc=jic23@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mripard@kernel.org \
--cc=nicolas.ferre@microchip.com \
--cc=nuno.sa@analog.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox