[PATCH 5/5] ALSA: seq: Don't lose partial read failure
From: Takashi Iwai
Date: Tue Oct 06 2026 - 13:41:55 EST
snd_seq_read() returns an error even if one or more events have been
successfully read before the error (except for -EAGAIN case), but this
rather doesn't follow the POSIX standard that wants the processed
bytes. Change the behavior to return the processed bytes when it's
positive, instead.
Reported-by: Sashiko <sashiko-bot@xxxxxxxxxx>
Signed-off-by: Takashi Iwai <tiwai@xxxxxxx>
---
sound/core/seq/seq_clientmgr.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/sound/core/seq/seq_clientmgr.c b/sound/core/seq/seq_clientmgr.c
index ba5619d0b0b0..0711a9e23b5f 100644
--- a/sound/core/seq/seq_clientmgr.c
+++ b/sound/core/seq/seq_clientmgr.c
@@ -480,11 +480,11 @@ static ssize_t snd_seq_read(struct file *file, char __user *buf, size_t count,
if (err < 0) {
if (cell)
snd_seq_fifo_cell_putback(fifo, cell);
- if (err == -EAGAIN && result > 0)
- err = 0;
}
- return (err < 0) ? err : result;
+ if (result > 0)
+ return result;
+ return err < 0 ? err : 0;
}
--
2.55.0