aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/iio/adc
diff options
context:
space:
mode:
authorLars-Peter Clausen <lars@metafoo.de>2013-10-24 05:41:00 -0400
committerJonathan Cameron <jic23@kernel.org>2013-11-09 07:33:24 -0500
commitfe26980e03f435164777184a91c1e5f3b4ed22a5 (patch)
tree80498933c52076c599558222b5aa0186ee1e2bb5 /drivers/iio/adc
parent5fa4061301d246203276a663f293c0d2beaec128 (diff)
iio: adc: ti_am335x_adc: avoid double free of buffer.
The driver is missing the iio_buffer_attach() call. As such it will attempt to free the buffer twice on removal. Introduced in commit 9e69c9 ("iio: Add reference counting for buffers"). Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Reported-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Diffstat (limited to 'drivers/iio/adc')
-rw-r--r--drivers/iio/adc/ti_am335x_adc.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/drivers/iio/adc/ti_am335x_adc.c b/drivers/iio/adc/ti_am335x_adc.c
index 728411ec7642..d4d748214e4b 100644
--- a/drivers/iio/adc/ti_am335x_adc.c
+++ b/drivers/iio/adc/ti_am335x_adc.c
@@ -229,12 +229,15 @@ static int tiadc_iio_buffered_hardware_setup(struct iio_dev *indio_dev,
229 unsigned long flags, 229 unsigned long flags,
230 const struct iio_buffer_setup_ops *setup_ops) 230 const struct iio_buffer_setup_ops *setup_ops)
231{ 231{
232 struct iio_buffer *buffer;
232 int ret; 233 int ret;
233 234
234 indio_dev->buffer = iio_kfifo_allocate(indio_dev); 235 buffer = iio_kfifo_allocate(indio_dev);
235 if (!indio_dev->buffer) 236 if (!buffer)
236 return -ENOMEM; 237 return -ENOMEM;
237 238
239 iio_device_attach_buffer(indio_dev, buffer);
240
238 ret = request_threaded_irq(irq, pollfunc_th, pollfunc_bh, 241 ret = request_threaded_irq(irq, pollfunc_th, pollfunc_bh,
239 flags, indio_dev->name, indio_dev); 242 flags, indio_dev->name, indio_dev);
240 if (ret) 243 if (ret)