aboutsummaryrefslogtreecommitdiff
path: root/sys/dev/sound
diff options
context:
space:
mode:
authorAriff Abdullah <ariff@FreeBSD.org>2007-06-03 10:56:22 +0000
committerAriff Abdullah <ariff@FreeBSD.org>2007-06-03 10:56:22 +0000
commit9c271f79d6c42c3c0c8dff4327a8e332fb7d7280 (patch)
treeaf9d8d6a30e60d2859632a6bfde4ada021952cbe /sys/dev/sound
parentcf924571a3bd73d02bc878aa70e36b0338812dbf (diff)
Notes
Diffstat (limited to 'sys/dev/sound')
-rw-r--r--sys/dev/sound/pcm/dsp.c3
-rw-r--r--sys/dev/sound/pcm/mixer.c3
-rw-r--r--sys/dev/sound/pcm/sound.c12
3 files changed, 12 insertions, 6 deletions
diff --git a/sys/dev/sound/pcm/dsp.c b/sys/dev/sound/pcm/dsp.c
index 2d633b22f3e04..90453c181f595 100644
--- a/sys/dev/sound/pcm/dsp.c
+++ b/sys/dev/sound/pcm/dsp.c
@@ -1916,7 +1916,8 @@ dsp_oss_audioinfo(struct cdev *i_dev, oss_audioinfo *ai)
* Search for the requested audio device (channel). Start by
* iterating over pcm devices.
*/
- for (i = 0; i < devclass_get_maxunit(pcm_devclass); i++) {
+ for (i = 0; pcm_devclass != NULL &&
+ i < devclass_get_maxunit(pcm_devclass); i++) {
d = devclass_get_softc(pcm_devclass, i);
if (d == NULL)
continue;
diff --git a/sys/dev/sound/pcm/mixer.c b/sys/dev/sound/pcm/mixer.c
index b0c2176dfa7e6..b7b5032b2e8a5 100644
--- a/sys/dev/sound/pcm/mixer.c
+++ b/sys/dev/sound/pcm/mixer.c
@@ -940,7 +940,8 @@ mixer_oss_mixerinfo(struct cdev *i_dev, oss_mixerinfo *mi)
* There's a 1:1 relationship between mixers and PCM devices, so
* begin by iterating over PCM devices and search for our mixer.
*/
- for (i = 0; i < devclass_get_maxunit(pcm_devclass); i++) {
+ for (i = 0; pcm_devclass != NULL &&
+ i < devclass_get_maxunit(pcm_devclass); i++) {
d = devclass_get_softc(pcm_devclass, i);
if (d == NULL)
continue;
diff --git a/sys/dev/sound/pcm/sound.c b/sys/dev/sound/pcm/sound.c
index 3fe301d2f3b9f..dee3c99dd9590 100644
--- a/sys/dev/sound/pcm/sound.c
+++ b/sys/dev/sound/pcm/sound.c
@@ -469,7 +469,8 @@ sysctl_hw_snd_maxautovchans(SYSCTL_HANDLER_ARGS)
if (v > SND_MAXVCHANS)
v = SND_MAXVCHANS;
snd_maxautovchans = v;
- for (i = 0; i < devclass_get_maxunit(pcm_devclass); i++) {
+ for (i = 0; pcm_devclass != NULL &&
+ i < devclass_get_maxunit(pcm_devclass); i++) {
d = devclass_get_softc(pcm_devclass, i);
if (d == NULL)
continue;
@@ -914,7 +915,8 @@ sysctl_hw_snd_clone_gc(SYSCTL_HANDLER_ARGS)
err = sysctl_handle_int(oidp, &val, sizeof(val), req);
if (err == 0 && req->newptr != NULL && val != 0) {
- for (i = 0; i < devclass_get_maxunit(pcm_devclass); i++) {
+ for (i = 0; pcm_devclass != NULL &&
+ i < devclass_get_maxunit(pcm_devclass); i++) {
d = devclass_get_softc(pcm_devclass, i);
if (d == NULL || d->clones == NULL)
continue;
@@ -1130,7 +1132,8 @@ pcm_unregister(device_t dev)
/*
* Reassign default unit to the next available dev.
*/
- for (i = 0; i < devclass_get_maxunit(pcm_devclass); i++) {
+ for (i = 0; pcm_devclass != NULL &&
+ i < devclass_get_maxunit(pcm_devclass); i++) {
if (device_get_unit(dev) == i ||
devclass_get_softc(pcm_devclass, i) == NULL)
continue;
@@ -1332,7 +1335,8 @@ sound_oss_sysinfo(oss_sysinfo *si)
if (pcm_devclass != NULL) {
j = 0;
- for (i = 0; i < devclass_get_maxunit(pcm_devclass); i++) {
+ for (i = 0; pcm_devclass != NULL &&
+ i < devclass_get_maxunit(pcm_devclass); i++) {
d = devclass_get_softc(pcm_devclass, i);
if (!d)
continue;