summaryrefslogtreecommitdiff
path: root/drivers/iio/adc
diff options
context:
space:
mode:
authorKangjie Lu <kjlu@umn.edu>2019-03-09 07:53:55 +0300
committerJonathan Cameron <Jonathan.Cameron@huawei.com>2019-04-04 22:19:53 +0300
commit13814627c9658cf8382dd052bc251ee415670a55 (patch)
tree1096799b4f1e422dbb11495ef57ff4656019da51 /drivers/iio/adc
parentd43102f525d9d7a727e086d23e7c27dd665a36d4 (diff)
downloadlinux-13814627c9658cf8382dd052bc251ee415670a55.tar.xz
iio: adc: fix a potential NULL pointer dereference
devm_iio_trigger_alloc may fail and return NULL. The fix returns ENOMEM when it fails. Signed-off-by: Kangjie Lu <kjlu@umn.edu> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Diffstat (limited to 'drivers/iio/adc')
-rw-r--r--drivers/iio/adc/mxs-lradc-adc.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/iio/adc/mxs-lradc-adc.c b/drivers/iio/adc/mxs-lradc-adc.c
index c627513d9f0f..5384472b6c4d 100644
--- a/drivers/iio/adc/mxs-lradc-adc.c
+++ b/drivers/iio/adc/mxs-lradc-adc.c
@@ -465,6 +465,8 @@ static int mxs_lradc_adc_trigger_init(struct iio_dev *iio)
trig = devm_iio_trigger_alloc(&iio->dev, "%s-dev%i", iio->name,
iio->id);
+ if (!trig)
+ return -ENOMEM;
trig->dev.parent = adc->dev;
iio_trigger_set_drvdata(trig, iio);