Skip to content

Commit

Permalink
Staging: iio: test for failed allocation
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Dan Carpenter authored and Greg Kroah-Hartman committed Apr 30, 2010
1 parent 0b64c38 commit ef6d4f5
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions drivers/staging/iio/accel/lis3l02dq_ring.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit ef6d4f5

Please sign in to comment.