linux-iio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jonathan Cameron <jic23@kernel.org>
To: Manuel Stahl <manuel.stahl@iis.fraunhofer.de>
Cc: linux-iio@vger.kernel.org, jic23@cam.ac.uk
Subject: Re: [PATCH 3/3] staging: iio: core: add error message when buffer length is zero
Date: Thu, 12 Jan 2012 19:35:06 +0000	[thread overview]
Message-ID: <4F0F35EA.1010507@kernel.org> (raw)
In-Reply-To: <1326124974-7288-3-git-send-email-manuel.stahl@iis.fraunhofer.de>

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) {

  reply	other threads:[~2012-01-12 19:35 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-01-09 16:02 [PATCH 1/3] staging: iio: core: fix argument of iio_buffer_register (must be const) Manuel Stahl
2012-01-09 16:02 ` [PATCH 2/3] staging: iio: core: add missing spaces to error output Manuel Stahl
2012-01-12 19:32   ` Jonathan Cameron
2012-01-09 16:02 ` [PATCH 3/3] staging: iio: core: add error message when buffer length is zero Manuel Stahl
2012-01-12 19:35   ` Jonathan Cameron [this message]
2012-01-12 19:31 ` [PATCH 1/3] staging: iio: core: fix argument of iio_buffer_register (must be const) Jonathan Cameron
2012-01-12 19:32   ` Jonathan Cameron

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4F0F35EA.1010507@kernel.org \
    --to=jic23@kernel.org \
    --cc=jic23@cam.ac.uk \
    --cc=linux-iio@vger.kernel.org \
    --cc=manuel.stahl@iis.fraunhofer.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).