Re: [PATCH v3 7/7] ALSA: seq: Don't lose partial read failure

From: Cezary Rojewski

Date: Thu Oct 08 2026 - 07:44:08 EST


On 10/8/2026 10:53 AM, Takashi Iwai wrote:
> On Thu, 08 Oct 2026 10:32:29 +0200,
> Cezary Rojewski wrote:

>>> --- 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;
>>
>> Can 'err' even be positive? Looks to me as if 'result' holds the bytes
>> and flat 'return err' suffices.
>
> Yes, it's just to make sure.
It's not a blocker obviously, I'm just in favor of avoiding
double-protection. I'd rather fix the problem that causes 'err' to be
positive if somehow things turn that way.

Kind regards,
Czarek