Thread (34 messages) 34 messages, 7 authors, 2023-12-10
STALE912d
Revisions (5)
  1. v1 [diff vs current]
  2. v2 [diff vs current]
  3. v3 current
  4. v4 [diff vs current]
  5. v5 [diff vs current]

[PATCH v3 02/13] iio: adc: ad7091r: Populate device driver data field

From: Marcelo Schmitt <marcelo.schmitt@analog.com>
Date: 2023-12-07 18:38:46
Also in: linux-iio, lkml
Subsystem: analog devices inc ad7091r driver, analog devices inc iio drivers, iio subsystem and drivers, the rest · Maintainers: Marcelo Schmitt, Lars-Peter Clausen, Michael Hennerich, Jonathan Cameron, Linus Torvalds

Set device driver data so it can be retrieved when handling alert
events, avoiding null pointer dereference.

Fixes: ca69300173b6 ("iio: adc: Add support for AD7091R5 ADC")
Signed-off-by: Marcelo Schmitt <marcelo.schmitt@analog.com>
---
 drivers/iio/adc/ad7091r-base.c | 1 +
 1 file changed, 1 insertion(+)
diff --git a/drivers/iio/adc/ad7091r-base.c b/drivers/iio/adc/ad7091r-base.c
index 8e252cde735b..0f192fbecbd4 100644
--- a/drivers/iio/adc/ad7091r-base.c
+++ b/drivers/iio/adc/ad7091r-base.c
@@ -232,6 +232,7 @@ int ad7091r_probe(struct device *dev, const char *name,
 	iio_dev->channels = chip_info->channels;
 
 	if (irq) {
+		dev_set_drvdata(st->dev, iio_dev);
 		ret = devm_request_threaded_irq(dev, irq, NULL,
 				ad7091r_event_handler,
 				IRQF_TRIGGER_FALLING | IRQF_ONESHOT, name, st);
-- 
2.42.0
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help