summaryrefslogtreecommitdiffstats
path: root/drivers/iio
diff options
context:
space:
mode:
authorKangjie Lu2019-03-09 05:53:55 +0100
committerJonathan Cameron2019-04-04 21:19:53 +0200
commit13814627c9658cf8382dd052bc251ee415670a55 (patch)
tree1096799b4f1e422dbb11495ef57ff4656019da51 /drivers/iio
parentiio: dac: ti-dac5571: Update the module author email address (diff)
downloadkernel-qcow2-linux-13814627c9658cf8382dd052bc251ee415670a55.tar.gz
kernel-qcow2-linux-13814627c9658cf8382dd052bc251ee415670a55.tar.xz
kernel-qcow2-linux-13814627c9658cf8382dd052bc251ee415670a55.zip
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')
-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);