[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <4B9F64DC.3080602@cam.ac.uk>
Date: Tue, 16 Mar 2010 11:00:44 +0000
From: Jonathan Cameron <jic23@....ac.uk>
To: Dan Carpenter <error27@...il.com>,
Greg Kroah-Hartman <gregkh@...e.de>,
devel@...verdev.osuosl.org, linux-kernel@...r.kernel.org,
kernel-janitors@...r.kernel.org
Subject: Re: [patch] iio: test for failed allocation
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@...il.com>
Indeed. Another one for the stupid errors pile!
Thanks.
Acked-by: Jonathan Cameron <jic23@....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;
>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists