Source-Changes-HG archive

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

[src/trunk]: src/sys/dev Fix division by zero when precision < 8 in ifdef AUD...



details:   https://anonhg.NetBSD.org/src/rev/bd7a1db95a62
branches:  trunk
changeset: 355025:bd7a1db95a62
user:      isaki <isaki%NetBSD.org@localhost>
date:      Sun Jul 09 12:08:39 2017 +0000

description:
Fix division by zero when precision < 8 in ifdef AUDIO_INTR_TIME.

diffstat:

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

diffs (44 lines):

diff -r 6a75eaad0569 -r bd7a1db95a62 sys/dev/audio.c
--- a/sys/dev/audio.c   Sun Jul 09 10:41:40 2017 +0000
+++ b/sys/dev/audio.c   Sun Jul 09 12:08:39 2017 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: audio.c,v 1.367 2017/07/01 05:44:52 nat Exp $  */
+/*     $NetBSD: audio.c,v 1.368 2017/07/09 12:08:39 isaki Exp $        */
 
 /*-
  * Copyright (c) 2016 Nathanial Sloss <nathanialsloss%yahoo.com.au@localhost>
@@ -148,7 +148,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: audio.c,v 1.367 2017/07/01 05:44:52 nat Exp $");
+__KERNEL_RCSID(0, "$NetBSD: audio.c,v 1.368 2017/07/09 12:08:39 isaki Exp $");
 
 #ifdef _KERNEL_OPT
 #include "audio.h"
@@ -2068,9 +2068,9 @@
                sc->sc_pnintr = 0;
                sc->sc_pblktime = (u_long)(
                    (double)vc->sc_mpr.blksize * 100000 /
-                   (double)(vc->sc_pparams.precision / NBBY *
-                            vc->sc_pparams.channels *
-                            vc->sc_pparams.sample_rate)) * 10;
+                   (double)(vc->sc_pparams.channels *
+                            vc->sc_pparams.sample_rate *
+                            vc->sc_pparams.precision / NBBY)) * 10;
                DPRINTF(("audio: play blktime = %lu for %d\n",
                         sc->sc_pblktime, vc->sc_mpr.blksize));
        }
@@ -2078,9 +2078,9 @@
                sc->sc_rnintr = 0;
                sc->sc_rblktime = (u_long)(
                    (double)vc->sc_mrr.blksize * 100000 /
-                   (double)(vc->sc_rparams.precision / NBBY *
-                            vc->sc_rparams.channels *
-                            vc->sc_rparams.sample_rate)) * 10;
+                   (double)(vc->sc_rparams.channels *
+                            vc->sc_rparams.sample_rate *
+                            vc->sc_rparams.precision / NBBY)) * 10;
                DPRINTF(("audio: record blktime = %lu for %d\n",
                         sc->sc_rblktime, vc->sc_mrr.blksize));
        }



Home | Main Index | Thread Index | Old Index