alsa-devel.alsa-project.org archive mirror
 help / color / mirror / Atom feed
From: Vinod Koul <vinod.koul@intel.com>
To: Richard Fitzgerald <rf@opensource.wolfsonmicro.com>
Cc: alsa-devel@alsa-project.org,
	pierre-louis.bossart@linux.jf.intel.com, elaurent@google.com
Subject: Re: [TINYCOMPRESS][PATCH] compress: compress_wait() must return error if timed out
Date: Tue, 12 Nov 2013 10:31:14 +0530	[thread overview]
Message-ID: <20131112050114.GJ8834@intel.com> (raw)
In-Reply-To: <20131022105158.GA12320@opensource.wolfsonmicro.com>

On Tue, Oct 22, 2013 at 11:51:58AM +0100, Richard Fitzgerald wrote:
> The caller must be certain that a return of 0 really means
> that compress is ready for more data, so when poll() returns
> 0 for a timeout we must report that as an error.
Applied, thanks

--
~Vinod
> 
> Signed-off-by: Richard Fitzgerald <rf@opensource.wolfsonmicro.com>
> ---
>  compress.c |   18 ++++++++++--------
>  1 files changed, 10 insertions(+), 8 deletions(-)
> 
> diff --git a/compress.c b/compress.c
> index 5cd0966..d1a2283 100644
> --- a/compress.c
> +++ b/compress.c
> @@ -616,15 +616,17 @@ int compress_wait(struct compress *compress, int timeout_ms)
>  	fds.events = POLLOUT | POLLIN;
>  
>  	ret = poll(&fds, 1, timeout_ms);
> -	if (fds.revents & POLLERR) {
> -		return oops(compress, EIO, "poll returned error!");
> +	if (ret > 0) {
> +		if (fds.revents & POLLERR)
> +			return oops(compress, EIO, "poll returned error!");
> +		if (fds.revents & (POLLOUT | POLLIN))
> +			return 0;
>  	}
> -	/* A pause will cause -EBADFD or zero. */
> -	if ((ret < 0) && (ret != -EBADFD))
> +	if (ret == 0)
> +		return oops(compress, ETIME, "poll timed out");
> +	if (ret < 0)
>  		return oops(compress, errno, "poll error");
> -	if (fds.revents & (POLLOUT | POLLIN)) {
> -		return 0;
> -	}
> -	return ret;
> +
> +	return oops(compress, EIO, "poll signalled unhandled event");
>  }
>  
> -- 
> 1.7.2.5
> 

-- 

      reply	other threads:[~2013-11-12  5:56 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-10-22 10:51 [TINYCOMPRESS][PATCH] compress: compress_wait() must return error if timed out Richard Fitzgerald
2013-11-12  5:01 ` Vinod Koul [this message]

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=20131112050114.GJ8834@intel.com \
    --to=vinod.koul@intel.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=elaurent@google.com \
    --cc=pierre-louis.bossart@linux.jf.intel.com \
    --cc=rf@opensource.wolfsonmicro.com \
    /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).