Skip to content

Commit

Permalink
iio:buffer: Free active scan mask in iio_disable_all_buffers()
Browse files Browse the repository at this point in the history
Usually the active scan mask is freed in __iio_update_buffers() when the buffer
is disabled. But when the device is still sampling when it is removed we'll end
up disabling the buffers in iio_disable_all_buffers(). So we also need to free
the active scan mask here, otherwise it will be leaked.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
  • Loading branch information
Lars-Peter Clausen authored and Jonathan Cameron committed Oct 15, 2013
1 parent 00bfacf commit e086ed7
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions drivers/iio/industrialio-buffer.c
Original file line number Diff line number Diff line change
Expand Up @@ -477,6 +477,9 @@ void iio_disable_all_buffers(struct iio_dev *indio_dev)
indio_dev->currentmode = INDIO_DIRECT_MODE;
if (indio_dev->setup_ops->postdisable)
indio_dev->setup_ops->postdisable(indio_dev);

if (indio_dev->available_scan_masks == NULL)
kfree(indio_dev->active_scan_mask);
}

int iio_update_buffers(struct iio_dev *indio_dev,
Expand Down

0 comments on commit e086ed7

Please sign in to comment.