summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorDan Carpenter <error27@gmail.com>2010-03-16 13:03:49 +0300
committerGreg Kroah-Hartman <gregkh@suse.de>2010-04-30 09:30:08 -0700
commitef6d4f54cca5962127b47ee8a355611aafedd526 (patch)
treea1a151ec24222c49b6c010ebce7fb8d570529e0c /drivers
parent0b64c38b71d6e2c1049c75bb1d885031008700c1 (diff)
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>
Diffstat (limited to 'drivers')
-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;