Module Name:    src
Committed By:   isaki
Date:           Sat Mar 26 06:36:06 UTC 2022

Modified Files:
        src/sys/dev/audio: audio.c

Log Message:
Clarify the assertion in audio_rmixer_process().
By previous commit (r1.116), the assersion no longer fires even without
this modification.  But the condition was a bit inaccurate.
There is no need to check the data length must be aligned to blocks here
(though it also should be aligned now).  What we should check here is that
the tail must be aligned.


To generate a diff of this commit:
cvs rdiff -u -r1.116 -r1.117 src/sys/dev/audio/audio.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/audio/audio.c
diff -u src/sys/dev/audio/audio.c:1.116 src/sys/dev/audio/audio.c:1.117
--- src/sys/dev/audio/audio.c:1.116	Sat Mar 26 06:27:32 2022
+++ src/sys/dev/audio/audio.c	Sat Mar 26 06:36:06 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: audio.c,v 1.116 2022/03/26 06:27:32 isaki Exp $	*/
+/*	$NetBSD: audio.c,v 1.117 2022/03/26 06:36:06 isaki Exp $	*/
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -138,7 +138,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: audio.c,v 1.116 2022/03/26 06:27:32 isaki Exp $");
+__KERNEL_RCSID(0, "$NetBSD: audio.c,v 1.117 2022/03/26 06:36:06 isaki Exp $");
 
 #ifdef _KERNEL_OPT
 #include "audio.h"
@@ -5919,10 +5919,10 @@ audio_rmixer_process(struct audio_softc 
 			    input->head, input->used, input->capacity);
 			auring_take(input, drops);
 		}
-		KASSERTMSG(input->used % mixer->frames_per_block == 0,
-		    "input->used=%d mixer->frames_per_block=%d",
-		    input->used, mixer->frames_per_block);
 
+		KASSERTMSG(auring_tail(input) % mixer->frames_per_block == 0,
+		    "inputtail=%d mixer->frames_per_block=%d",
+		    auring_tail(input), mixer->frames_per_block);
 		memcpy(auring_tailptr_aint(input),
 		    auring_headptr_aint(mixersrc),
 		    bytes);

Reply via email to