Re: [PATCH 1/2 v2] iio: adc: ti_am335x_adc: do not free the kfifo twice

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




Sebastian Andrzej Siewior <bigeasy@xxxxxxxxxxxxx> wrote:
>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.

It is late and I haven't looked at this in much detail but I suspect that this is a reference count issue as the allocation of indio_dev->buffer is directly rather than via iio_buffer_activate. Lars?
>
>Cc: Lars-Peter Clausen <lars@xxxxxxxxxx>
>Signed-off-by: Sebastian Andrzej Siewior <bigeasy@xxxxxxxxxxxxx>
>---
>v1…v2: make it compile after removal of error_kfifo_free label. Grml.
>       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_adc.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 = request_threaded_irq(irq,	pollfunc_th, pollfunc_bh,
> 				flags, indio_dev->name, indio_dev);
> 	if (ret)
>-		goto error_kfifo_free;
>+		return ret;
> 
> 	indio_dev->setup_ops = setup_ops;
> 	indio_dev->modes |= INDIO_BUFFER_HARDWARE;
>@@ -254,8 +254,6 @@ static int tiadc_iio_buffered_hardware_setup(struct
>iio_dev *indio_dev,
> 
> error_free_irq:
> 	free_irq(irq, indio_dev);
>-error_kfifo_free:
>-	iio_kfifo_free(indio_dev->buffer);
> 	return ret;
> }
> 
>@@ -264,7 +262,6 @@ static void
>tiadc_iio_buffered_hardware_remove(struct iio_dev *indio_dev)
> 	struct tiadc_device *adc_dev = iio_priv(indio_dev);
> 
> 	free_irq(adc_dev->mfd_tscadc->irq, indio_dev);
>-	iio_kfifo_free(indio_dev->buffer);
> 	iio_buffer_unregister(indio_dev);
> }
> 

-- 
Sent from my Android phone with K-9 Mail. Please excuse my brevity.
--
To unsubscribe from this list: send the line "unsubscribe linux-iio" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Input]     [Linux Kernel]     [Linux SCSI]     [X.org]

  Powered by Linux