Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/hdaudio If the step is 0, use 1 instead of always in...



details:   https://anonhg.NetBSD.org/src/rev/9da4ba6142f0
branches:  trunk
changeset: 1027728:9da4ba6142f0
user:      christos <christos%NetBSD.org@localhost>
date:      Fri Dec 17 13:36:36 2021 +0000

description:
If the step is 0, use 1 instead of always incrementing step by one to avoid
zerodivide (from RVP)

diffstat:

 sys/dev/hdaudio/hdafg.c |  10 ++++++----
 1 files changed, 6 insertions(+), 4 deletions(-)

diffs (38 lines):

diff -r 909474dcdff6 -r 9da4ba6142f0 sys/dev/hdaudio/hdafg.c
--- a/sys/dev/hdaudio/hdafg.c   Fri Dec 17 13:14:54 2021 +0000
+++ b/sys/dev/hdaudio/hdafg.c   Fri Dec 17 13:36:36 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: hdafg.c,v 1.23 2020/06/11 02:39:30 thorpej Exp $ */
+/* $NetBSD: hdafg.c,v 1.24 2021/12/17 13:36:36 christos Exp $ */
 
 /*
  * Copyright (c) 2009 Precedence Technologies Ltd <support%precedence.co.uk@localhost>
@@ -60,7 +60,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: hdafg.c,v 1.23 2020/06/11 02:39:30 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: hdafg.c,v 1.24 2021/12/17 13:36:36 christos Exp $");
 
 #include <sys/types.h>
 #include <sys/param.h>
@@ -2887,7 +2887,8 @@
                mx[index].mx_di.prev = mx[index].mx_di.next = AUDIO_MIXER_LAST;
                mx[index].mx_di.un.v.num_channels = 2;  /* XXX */
                mx[index].mx_di.mixer_class = HDAUDIO_MIXER_CLASS_OUTPUTS;
-               mx[index].mx_di.un.v.delta = 256 / (masterctl->ctl_step + 1);
+               mx[index].mx_di.un.v.delta = 256 / 
+                   (ctl->ctl_step ? ctl->ctl_step : 1);
                strcpy(mx[index].mx_di.label.name, AudioNmaster);
                strcpy(mx[index].mx_di.un.v.units.name, AudioNvolume);
                hda_trace(sc, "  adding outputs.%s\n",
@@ -2922,7 +2923,8 @@
                mx[index].mx_di.type = AUDIO_MIXER_VALUE;
                mx[index].mx_di.prev = mx[index].mx_di.next = AUDIO_MIXER_LAST;
                mx[index].mx_di.un.v.num_channels = 2;  /* XXX */
-               mx[index].mx_di.un.v.delta = 256 / (ctl->ctl_step + 1);
+               mx[index].mx_di.un.v.delta = 256 /
+                   (ctl->ctl_step ? ctl->ctl_step : 1);
                if (ctrlcnt[audiodev] > 0)
                        snprintf(mx[index].mx_di.label.name,
                            sizeof(mx[index].mx_di.label.name),



Home | Main Index | Thread Index | Old Index