iio: test for failed allocation
Subsystems (4)
PATCH 1/1 iio: test for failed allocation
We should return test to see if iio_allocate_trigger() fails and return -ENOMEM.
Signed-off-by Dan Carpenter <[email protected]>
drivers/staging/iio/accel/lis3l02dq_ring.c +3 -0
@@ -492,6 +492,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 ;
Quoted 3 lines · Dan Carpenter
We should return test to see if
iio_allocate_trigger()fails and return-ENOMEM.Signed-off-by Dan Carpenter <[email protected]>
Indeed. Another one for the stupid errors pile!
Thanks.
Acked-by Jonathan Cameron <[email protected]>
Quoted 16 lines
drivers/staging/iio/accel/lis3l02dq_ring.c +3
-0@@ -492,6 +492,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 ;