[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20100316100349.GA4219@bicker>
Date: Tue, 16 Mar 2010 13:03:49 +0300
From: Dan Carpenter <error27@...il.com>
To: Greg Kroah-Hartman <gregkh@...e.de>
Cc: Jonathan Cameron <jic23@....ac.uk>, devel@...verdev.osuosl.org,
linux-kernel@...r.kernel.org, kernel-janitors@...r.kernel.org
Subject: [patch] iio: test for failed allocation
We should return test to see if iio_allocate_trigger() fails and return -ENOMEM.
Signed-off-by: Dan Carpenter <error27@...il.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;
--
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