Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev/audio Clarify the assertion in audio_rmixer_process().



details:   https://anonhg.NetBSD.org/src/rev/db20a5accfc6
branches:  trunk
changeset: 364456:db20a5accfc6
user:      isaki <isaki%NetBSD.org@localhost>
date:      Sat Mar 26 06:36:06 2022 +0000

description:
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.

diffstat:

 sys/dev/audio/audio.c |  12 ++++++------
 1 files changed, 6 insertions(+), 6 deletions(-)

diffs (33 lines):

diff -r 757143ed0b98 -r db20a5accfc6 sys/dev/audio/audio.c
--- a/sys/dev/audio/audio.c     Sat Mar 26 06:27:32 2022 +0000
+++ b/sys/dev/audio/audio.c     Sat Mar 26 06:36:06 2022 +0000
@@ -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 @@
                            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);



Home | Main Index | Thread Index | Old Index