[prev in list] [next in list] [prev in thread] [next in thread] 

List:       linux-iio
Subject:    Re: [PATCH 3/3] staging: iio: core: add error message when buffer length is zero
From:       Jonathan Cameron <jic23 () kernel ! org>
Date:       2012-01-12 19:35:06
Message-ID: 4F0F35EA.1010507 () kernel ! org
[Download RAW message or body]

I'd like a little more or a commit message for this.

Why is such a message useful?  (I agree it probably is, having
at least once stumbled into a 0 length buffer myself).

Anyhow, a good idea.
> Signed-off-by: Manuel Stahl <manuel.stahl@iis.fraunhofer.de>
Acked-by: Jonathan Cameron <jic23@kernel.org>

Thanks for these 3 patches Manuel, and glad to see you are active in IIO
again!
> ---
>  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) {

--
To unsubscribe from this list: send the line "unsubscribe linux-iio" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic