linux-iio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
To: Jonathan Cameron <jic23@kernel.org>
Cc: Felipe Balbi <balbi@ti.com>,
	linux-iio@vger.kernel.org, Lars-Peter Clausen <lars@metafoo.de>
Subject: [PATCH 1/2 v2] iio: adc: ti_am335x_adc: do not free the kfifo twice
Date: Wed, 23 Oct 2013 21:36:20 +0200	[thread overview]
Message-ID: <20131023193620.GA5874@linutronix.de> (raw)
In-Reply-To: <1382547624-15256-1-git-send-email-bigeasy@linutronix.de>

Since commit 9e69c9 ("iio: Add reference counting for buffers") the iio
core frees the buffer. So if the driver does it as well then bad things
will happen.

Cc: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
---
v1=E2=80=A6v2: make it compile after removal of error_kfifo_free label. Grm=
l.
       I tested it before I removed the same thing from
       tiadc_iio_buffered_hardware_setup()

 drivers/iio/adc/ti_am335x_adc.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/drivers/iio/adc/ti_am335x_adc.c b/drivers/iio/adc/ti_am335x_ad=
c.c
index f974dea..4f6e0ce 100644
--- a/drivers/iio/adc/ti_am335x_adc.c
+++ b/drivers/iio/adc/ti_am335x_adc.c
@@ -239,7 +239,7 @@ static int tiadc_iio_buffered_hardware_setup(struct iio=
_dev *indio_dev,
 	ret =3D request_threaded_irq(irq,	pollfunc_th, pollfunc_bh,
 				flags, indio_dev->name, indio_dev);
 	if (ret)
-		goto error_kfifo_free;
+		return ret;
=20
 	indio_dev->setup_ops =3D setup_ops;
 	indio_dev->modes |=3D INDIO_BUFFER_HARDWARE;
@@ -254,8 +254,6 @@ static int tiadc_iio_buffered_hardware_setup(struct iio=
_dev *indio_dev,
=20
 error_free_irq:
 	free_irq(irq, indio_dev);
-error_kfifo_free:
-	iio_kfifo_free(indio_dev->buffer);
 	return ret;
 }
=20
@@ -264,7 +262,6 @@ static void tiadc_iio_buffered_hardware_remove(struct i=
io_dev *indio_dev)
 	struct tiadc_device *adc_dev =3D iio_priv(indio_dev);
=20
 	free_irq(adc_dev->mfd_tscadc->irq, indio_dev);
-	iio_kfifo_free(indio_dev->buffer);
 	iio_buffer_unregister(indio_dev);
 }
=20
--=20
1.8.4.rc3

  parent reply	other threads:[~2013-10-23 19:36 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-10-23 17:00 [PATCH 1/2] iio: adc: ti_am335x_adc: do not free the kfifo twice Sebastian Andrzej Siewior
2013-10-23 17:00 ` [PATCH 2 / 2] iio: ti_am335x_adc: adjust the closing bracket in tiadc_read_raw() Sebastian Andrzej Siewior
2013-10-23 19:36 ` Sebastian Andrzej Siewior [this message]
2013-10-23 23:04   ` [PATCH 1/2 v2] iio: adc: ti_am335x_adc: do not free the kfifo twice Jonathan Cameron

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20131023193620.GA5874@linutronix.de \
    --to=bigeasy@linutronix.de \
    --cc=balbi@ti.com \
    --cc=jic23@kernel.org \
    --cc=lars@metafoo.de \
    --cc=linux-iio@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).