aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJulia Lawall <Julia.Lawall@lip6.fr>2014-01-01 13:07:00 +0000
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2014-02-22 13:34:50 -0800
commit001997bee99615c82796943011b4bcec451994fb (patch)
tree9cd8ea28b383cb448dc765eb85217867bd820fdd
parent78c5e6ba9895197556b2c20ffe002ba4bcea3741 (diff)
staging:iio:impedance:ad5933: correct error check
commit e9ed104de68c345c9a827225e93c74c6894613a9 upstream. iio_kfifo_allocate returns NULL in case of error. The semantic match that finds this problem is as follows: (http://coccinelle.lip6.fr/) // <smpl> @@ expression *x; identifier f; statement S1,S2; @@ *x = f(...); if (x) { <+... when != if (...) S1 else S2 -ENOMEM ...+> } // </smpl> Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr> Signed-off-by: Jonathan Cameron <jic23@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--drivers/staging/iio/impedance-analyzer/ad5933.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/staging/iio/impedance-analyzer/ad5933.c b/drivers/staging/iio/impedance-analyzer/ad5933.c
index 0a4298b744e..2b96665da8a 100644
--- a/drivers/staging/iio/impedance-analyzer/ad5933.c
+++ b/drivers/staging/iio/impedance-analyzer/ad5933.c
@@ -629,7 +629,7 @@ static int ad5933_register_ring_funcs_and_init(struct iio_dev *indio_dev)
struct iio_buffer *buffer;
buffer = iio_kfifo_allocate(indio_dev);
- if (buffer)
+ if (!buffer)
return -ENOMEM;
iio_device_attach_buffer(indio_dev, buffer);