summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Hay <jhay@FreeBSD.org>2002-04-14 10:39:59 +0000
committerJohn Hay <jhay@FreeBSD.org>2002-04-14 10:39:59 +0000
commitfcd478479db7490599ef2d88d0096a66f77aeb1c (patch)
treeec62343aa42a5b92cd461b81ac61f3ac30233d6f
parent79a3e97054d746540ef96b4f09366b72e8c0639b (diff)
Notes
-rw-r--r--sys/dev/sound/pci/ich.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/sys/dev/sound/pci/ich.c b/sys/dev/sound/pci/ich.c
index c44e221e3bc8..c6392855dabe 100644
--- a/sys/dev/sound/pci/ich.c
+++ b/sys/dev/sound/pci/ich.c
@@ -298,7 +298,12 @@ ichchan_setspeed(kobj_t obj, void *data, u_int32_t speed)
if (sc->ac97rate <= 32000 || sc->ac97rate >= 64000)
sc->ac97rate = 48000;
r = (speed * 48000) / sc->ac97rate;
- ch->spd = (ac97_setrate(sc->codec, ch->spdreg, r) * sc->ac97rate) / 48000;
+ /*
+ * Cast the return value of ac97_setrate() to u_int so that
+ * the math don't overflow into the negative range.
+ */
+ ch->spd = ((u_int)ac97_setrate(sc->codec, ch->spdreg, r) *
+ sc->ac97rate) / 48000;
} else {
ch->spd = 48000;
}
@@ -682,8 +687,8 @@ ich_pci_attach(device_t dev)
extcaps = ac97_getextcaps(sc->codec);
sc->hasvra = extcaps & AC97_EXTCAP_VRA;
sc->hasvrm = extcaps & AC97_EXTCAP_VRM;
- sc->hasmic = extcaps & AC97_CAP_MICCHANNEL;
- ac97_setextmode(sc->codec, sc->hasvra | sc->hasvrm | sc->hasmic);
+ sc->hasmic = ac97_getcaps(sc->codec) & AC97_CAP_MICCHANNEL;
+ ac97_setextmode(sc->codec, sc->hasvra | sc->hasvrm);
if (pcm_register(dev, sc, 1, sc->hasmic? 2 : 1))
goto bad;