From: Dan Carpenter Date: Tue, 16 Mar 2010 10:03:49 +0000 (+0300) Subject: Staging: iio: test for failed allocation X-Git-Tag: v2.6.34-rc7~36^2~15 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=ef6d4f54cca5962127b47ee8a355611aafedd526;p=platform%2Fkernel%2Flinux-3.10.git 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 Acked-by: Jonathan Cameron Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/staging/iio/accel/lis3l02dq_ring.c b/drivers/staging/iio/accel/lis3l02dq_ring.c index 9371243..a4d97ea 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;