Module Name:    src
Committed By:   nat
Date:           Thu Oct 26 22:45:00 UTC 2017

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

Log Message:
Ensure that the low/high water marks are at least PREFILL_BLOCKS.


To generate a diff of this commit:
cvs rdiff -u -r1.415 -r1.416 src/sys/dev/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.c
diff -u src/sys/dev/audio.c:1.415 src/sys/dev/audio.c:1.416
--- src/sys/dev/audio.c:1.415	Thu Oct 26 22:38:27 2017
+++ src/sys/dev/audio.c	Thu Oct 26 22:45:00 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: audio.c,v 1.415 2017/10/26 22:38:27 nat Exp $	*/
+/*	$NetBSD: audio.c,v 1.416 2017/10/26 22:45:00 nat Exp $	*/
 
 /*-
  * Copyright (c) 2016 Nathanial Sloss <nathanialsl...@yahoo.com.au>
@@ -148,7 +148,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: audio.c,v 1.415 2017/10/26 22:38:27 nat Exp $");
+__KERNEL_RCSID(0, "$NetBSD: audio.c,v 1.416 2017/10/26 22:45:00 nat Exp $");
 
 #ifdef _KERNEL_OPT
 #include "audio.h"
@@ -4769,14 +4769,16 @@ cleanup:
 		blks = ai->hiwat;
 		if (blks > vc->sc_mpr.maxblks)
 			blks = vc->sc_mpr.maxblks;
-		if (blks < 2)
-			blks = 2;
+		if (blks < PREFILL_BLOCKS + 1)
+			blks = PREFILL_BLOCKS + 1;
 		vc->sc_mpr.usedhigh = blks * vc->sc_mpr.blksize;
 	}
 	if (SPECIFIED(ai->lowat)) {
 		blks = ai->lowat;
 		if (blks > vc->sc_mpr.maxblks - 1)
 			blks = vc->sc_mpr.maxblks - 1;
+		if (blks < PREFILL_BLOCKS)
+			blks = PREFILL_BLOCKS;
 		vc->sc_mpr.usedlow = blks * vc->sc_mpr.blksize;
 	}
 	if (SPECIFIED(ai->hiwat) || SPECIFIED(ai->lowat)) {

Reply via email to