From: Jonathan Cameron Date: Wed, 26 Oct 2011 16:27:40 +0000 (+0100) Subject: staging:iio:kfifo remove entirely pointless code. X-Git-Tag: firefly_0821_release~3680^2~3804^2~101^2~338 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=4c3d15358a7ffdd587acc02ec91d28989334d4be;p=firefly-linux-kernel-4.4.55.git staging:iio:kfifo remove entirely pointless code. I really don't want to think about how this bit got in there. It allocates some storage - copies something into it then frees it without making use of it. Oops. Signed-off-by: Jonathan Cameron Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/staging/iio/kfifo_buf.c b/drivers/staging/iio/kfifo_buf.c index e8c234bb18f0..fd98a0ebb5ff 100644 --- a/drivers/staging/iio/kfifo_buf.c +++ b/drivers/staging/iio/kfifo_buf.c @@ -150,16 +150,9 @@ static int iio_store_to_kfifo(struct iio_buffer *r, { int ret; struct iio_kfifo *kf = iio_to_kfifo(r); - u8 *datal = kmalloc(r->bytes_per_datum, GFP_KERNEL); - memcpy(datal, data, r->bytes_per_datum - sizeof(timestamp)); - memcpy(datal + r->bytes_per_datum - sizeof(timestamp), - ×tamp, sizeof(timestamp)); ret = kfifo_in(&kf->kf, data, r->bytes_per_datum); - if (ret != r->bytes_per_datum) { - kfree(datal); + if (ret != r->bytes_per_datum) return -EBUSY; - } - kfree(datal); return 0; }