Skip to contentSkip to conversation

ALSA: seq_oss: return full count for successful SEQ_FULLSIZE writes

PATCH Applied Cássio Gabriel 2 participants 2 messages Mar 24 – Mar 27

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ALSA: seq_oss: return full count for successful SEQ_FULLSIZE writes

snd_seq_oss_write() currently returns the raw load_patch() callback result for SEQ_FULLSIZE events.

That callback is documented as returning 0 on success and -errno on failure, but snd_seq_oss_write() is the file write path and should report the number of user bytes consumed on success. Some in-tree backends also return backend-specific positive values, which can still be shorter than the original write size.

Return the full byte count for successful SEQ_FULLSIZE writes. Preserve negative errors and convert any nonnegative completion to the original count.

---
 sound/core/seq/oss/seq_oss_rw.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
sound/core/seq/oss/seq_oss_rw.c +3 -3
index 8a142fd54a19..307ef98c44c7 100644
@@ -101,9 +101,9 @@ snd_seq_oss_write(struct seq_oss_devinfo *dp, const char __user *buf, int count,
 				break;
 			}
 			fmt = (*(unsigned short *)rec.c) & 0xffff;
-			/* FIXME the return value isn't correct */
-			return snd_seq_oss_synth_load_patch(dp, rec.s.dev,
-							    fmt, buf, 0, count);
+			err = snd_seq_oss_synth_load_patch(dp, rec.s.dev,
+							   fmt, buf, 0, count);
+			return err < 0 ? err : count;
 		}
 		if (ev_is_long(&rec)) {
 			/* extended code */

---
base-commit: b3c48fa1fb397b490101785ddd87caf2e5513a66
change-id: 20260324-alsa-seq-oss-fullsize-write-return-0d1203bffe45

Best regards,

Signature · 1 line
Cássio Gabriel <[email protected]>
Applied
#1 lore raw
Quoted 10 lines · Cássio Gabriel

snd_seq_oss_write() currently returns the raw load_patch() callback result for SEQ_FULLSIZE events.

That callback is documented as returning 0 on success and -errno on failure, but snd_seq_oss_write() is the file write path and should report the number of user bytes consumed on success. Some in-tree backends also return backend-specific positive values, which can still be shorter than the original write size.

Quoted 6 lines

Return the full byte count for successful SEQ_FULLSIZE writes. Preserve negative errors and convert any nonnegative completion to the original count.

Applied to for-next branch now. Thanks.

Takashi