Signed-off-by: Manuel Stahl <manuel.stahl@xxxxxxxxxxxxxxxxx> --- drivers/staging/iio/industrialio-buffer.c | 11 +++++++++++ 1 files changed, 11 insertions(+), 0 deletions(-) diff --git a/drivers/staging/iio/industrialio-buffer.c b/drivers/staging/iio/industrialio-buffer.c index f5c4999..c789d39 100644 --- a/drivers/staging/iio/industrialio-buffer.c +++ b/drivers/staging/iio/industrialio-buffer.c @@ -426,6 +426,17 @@ ssize_t iio_buffer_store_enable(struct device *dev, goto done; } if (requested_state) { + if (buffer->access->get_length) { + ret = buffer->access->get_length(buffer); + if (ret <= 0) { + printk(KERN_INFO + "Buffer not started: " + "buffer length must be greater than zero\n"); + ret = -EINVAL; + goto error_ret; + } + } + if (indio_dev->setup_ops->preenable) { ret = indio_dev->setup_ops->preenable(indio_dev); if (ret) { -- 1.7.3.rc1 -- 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