summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDan Carpenter <error27@gmail.com>2010-03-16 11:03:49 +0100
committerGreg Kroah-Hartman <gregkh@suse.de>2010-04-30 18:30:08 +0200
commitef6d4f54cca5962127b47ee8a355611aafedd526 (patch)
treea1a151ec24222c49b6c010ebce7fb8d570529e0c
parentstaging: iio: lis3l02dq - incorrect ws used in container of call. (diff)
downloadlinux-ef6d4f54cca5962127b47ee8a355611aafedd526.tar.xz
linux-ef6d4f54cca5962127b47ee8a355611aafedd526.zip
Staging: iio: test for failed allocation
We should return test to see if iio_allocate_trigger() fails and return -ENOMEM. Signed-off-by: Dan Carpenter <error27@gmail.com> Acked-by: Jonathan Cameron <jic23@cam.ac.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
-rw-r--r--drivers/staging/iio/accel/lis3l02dq_ring.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/staging/iio/accel/lis3l02dq_ring.c b/drivers/staging/iio/accel/lis3l02dq_ring.c
index 93712430e579..a4d97ea0df3d 100644
--- a/drivers/staging/iio/accel/lis3l02dq_ring.c
+++ b/drivers/staging/iio/accel/lis3l02dq_ring.c
@@ -493,6 +493,9 @@ int lis3l02dq_probe_trigger(struct iio_dev *indio_dev)
struct lis3l02dq_state *state = indio_dev->dev_data;
state->trig = iio_allocate_trigger();
+ if (!state->trig)
+ return -ENOMEM;
+
state->trig->name = kmalloc(IIO_TRIGGER_NAME_LENGTH, GFP_KERNEL);
if (!state->trig->name) {
ret = -ENOMEM;