staging:iio:impedance:ad5933: correct error check

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>
cc: stable@vger.kernel.org
This commit is contained in:
Julia Lawall 2014-01-01 13:07:00 +00:00 committed by Jonathan Cameron
parent 83d5f3246f
commit e9ed104de6

View File

@ -629,7 +629,7 @@ static int ad5933_register_ring_funcs_and_init(struct iio_dev *indio_dev)
struct iio_buffer *buffer; struct iio_buffer *buffer;
buffer = iio_kfifo_allocate(indio_dev); buffer = iio_kfifo_allocate(indio_dev);
if (buffer) if (!buffer)
return -ENOMEM; return -ENOMEM;
iio_device_attach_buffer(indio_dev, buffer); iio_device_attach_buffer(indio_dev, buffer);