* [patch] iio: test for failed allocation
@ 2010-03-16 10:03 Dan Carpenter
2010-03-16 10:58 ` Jonathan Cameron
0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2010-03-16 10:03 UTC (permalink / raw)
To: Greg Kroah-Hartman; +Cc: Jonathan Cameron, devel, linux-kernel, kernel-janitors
We should return test to see if iio_allocate_trigger() fails and return -ENOMEM.
Signed-off-by: Dan Carpenter <error27@gmail.com>
diff --git a/drivers/staging/iio/accel/lis3l02dq_ring.c b/drivers/staging/iio/accel/lis3l02dq_ring.c
index a6b7c72..db3270f 100644
--- a/drivers/staging/iio/accel/lis3l02dq_ring.c
+++ b/drivers/staging/iio/accel/lis3l02dq_ring.c
@@ -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;
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: [patch] iio: test for failed allocation
2010-03-16 10:03 [patch] iio: test for failed allocation Dan Carpenter
@ 2010-03-16 10:58 ` Jonathan Cameron
0 siblings, 0 replies; 2+ messages in thread
From: Jonathan Cameron @ 2010-03-16 10:58 UTC (permalink / raw)
To: Dan Carpenter, Greg Kroah-Hartman, devel, linux-kernel,
kernel-janitors
On 03/16/10 10:03, Dan Carpenter wrote:
> We should return test to see if iio_allocate_trigger() fails and return -ENOMEM.
>
> Signed-off-by: Dan Carpenter <error27@gmail.com>
Indeed. Another one for the stupid errors pile!
Thanks.
Acked-by: Jonathan Cameron <jic23@cam.ac.uk>
>
> diff --git a/drivers/staging/iio/accel/lis3l02dq_ring.c b/drivers/staging/iio/accel/lis3l02dq_ring.c
> index a6b7c72..db3270f 100644
> --- a/drivers/staging/iio/accel/lis3l02dq_ring.c
> +++ b/drivers/staging/iio/accel/lis3l02dq_ring.c
> @@ -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;
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2010-03-16 10:58 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-03-16 10:03 [patch] iio: test for failed allocation Dan Carpenter
2010-03-16 10:58 ` Jonathan Cameron
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox