ALSA: compress: Fix poll error return codes
authorCharles Keepax <ckeepax@opensource.wolfsonmicro.com>
Wed, 4 May 2016 13:59:10 +0000 (14:59 +0100)
committerTakashi Iwai <tiwai@suse.de>
Mon, 9 May 2016 15:35:43 +0000 (17:35 +0200)
We can't return a negative error code from the poll callback the return
type is unsigned and is checked against the poll specific flags we need
to return POLLERR if we encounter an error.

Signed-off-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
Acked-by: Vinod Koul <vinod.koul@intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
sound/core/compress_offload.c

index 5215df2940b335eeeb8ed3c273a3c54714883c48..f56f4e358b76af67be38f24331de0d50eeef5810 100644 (file)
@@ -391,13 +391,13 @@ static unsigned int snd_compr_poll(struct file *f, poll_table *wait)
        int retval = 0;
 
        if (snd_BUG_ON(!data))
-               return -EFAULT;
+               return POLLERR;
 
        stream = &data->stream;
 
        mutex_lock(&stream->device->lock);
        if (stream->runtime->state == SNDRV_PCM_STATE_OPEN) {
-               retval = -EBADFD;
+               retval = snd_compr_get_poll(stream) | POLLERR;
                goto out;
        }
        poll_wait(f, &stream->runtime->sleep, wait);