[PATCH v6 3/8] iio: adc: at91_adc: switch to device_get_match_data()
Abdelnasser Hussein
abdelnasserhussein11 at gmail.com
Thu Dec 3 09:30:07 PST 2026
Replace of_device_get_match_data() with device_get_match_data() and
reject a missing match with -ENODATA instead of deferring the failure to
the first st->caps dereference.
Signed-off-by: Abdelnasser Hussein <abdelnasserhussein11 at gmail.com>
---
drivers/iio/adc/at91_adc.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/drivers/iio/adc/at91_adc.c b/drivers/iio/adc/at91_adc.c
index 9e7fa4adfc40..9439eef7b564 100644
--- a/drivers/iio/adc/at91_adc.c
+++ b/drivers/iio/adc/at91_adc.c
@@ -18,6 +18,7 @@
#include <linux/module.h>
#include <linux/of.h>
#include <linux/platform_device.h>
+#include <linux/property.h>
#include <linux/sched.h>
#include <linux/slab.h>
#include <linux/wait.h>
@@ -1010,7 +1011,9 @@ static int at91_adc_probe(struct platform_device *pdev)
st = iio_priv(idev);
- st->caps = of_device_get_match_data(&pdev->dev);
+ st->caps = device_get_match_data(&pdev->dev);
+ if (!st->caps)
+ return -ENODATA;
st->use_external = of_property_read_bool(node, "atmel,adc-use-external-triggers");
--
2.56.0
More information about the linux-arm-kernel
mailing list