ALSA: pcm: Fix poll error return codes
authorCharles Keepax <ckeepax@opensource.wolfsonmicro.com>
Wed, 4 May 2016 13:59:07 +0000 (14:59 +0100)
committerTakashi Iwai <tiwai@suse.de>
Mon, 9 May 2016 15:34:49 +0000 (17:34 +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>
Reviewed-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
sound/core/pcm_native.c

index 9106d8e2300eab3e566f9a3807c469ee02aa7bcd..c61fd50f771f9ecd55c8e472d152321b37255e71 100644 (file)
@@ -3161,7 +3161,7 @@ static unsigned int snd_pcm_playback_poll(struct file *file, poll_table * wait)
 
        substream = pcm_file->substream;
        if (PCM_RUNTIME_CHECK(substream))
-               return -ENXIO;
+               return POLLOUT | POLLWRNORM | POLLERR;
        runtime = substream->runtime;
 
        poll_wait(file, &runtime->sleep, wait);
@@ -3200,7 +3200,7 @@ static unsigned int snd_pcm_capture_poll(struct file *file, poll_table * wait)
 
        substream = pcm_file->substream;
        if (PCM_RUNTIME_CHECK(substream))
-               return -ENXIO;
+               return POLLIN | POLLRDNORM | POLLERR;
        runtime = substream->runtime;
 
        poll_wait(file, &runtime->sleep, wait);