summaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
authorcg <cg@FreeBSD.org>2001-06-18 00:10:47 +0000
committercg <cg@FreeBSD.org>2001-06-18 00:10:47 +0000
commitc24cb000aaa5bbdd7e7f432f0e5b4b9b6630341b (patch)
tree46512e528b7c30d47016c9906c58ea1a881f196f /sys
parent420f58376d042d11f15ba9760f51ad286889c0c1 (diff)
downloadFreeBSD-src-c24cb000aaa5bbdd7e7f432f0e5b4b9b6630341b.zip
FreeBSD-src-c24cb000aaa5bbdd7e7f432f0e5b4b9b6630341b.tar.gz
use devclass_get_maxunit() correctly
Diffstat (limited to 'sys')
-rw-r--r--sys/dev/sound/pcm/dsp.c4
-rw-r--r--sys/dev/sound/pcm/sndstat.c2
-rw-r--r--sys/dev/sound/pcm/sound.c2
3 files changed, 4 insertions, 4 deletions
diff --git a/sys/dev/sound/pcm/dsp.c b/sys/dev/sound/pcm/dsp.c
index 81d75da..2652d9a 100644
--- a/sys/dev/sound/pcm/dsp.c
+++ b/sys/dev/sound/pcm/dsp.c
@@ -66,7 +66,7 @@ dsp_get_info(dev_t dev)
int unit;
unit = PCMUNIT(dev);
- if (unit > devclass_get_maxunit(pcm_devclass))
+ if (unit >= devclass_get_maxunit(pcm_devclass))
return NULL;
d = devclass_get_softc(pcm_devclass, unit);
@@ -1024,7 +1024,7 @@ dsp_clone(void *arg, char *name, int namelen, dev_t *dev)
return;
gotit:
- if (unit == -1 || unit > devclass_get_maxunit(pcm_devclass))
+ if (unit == -1 || unit >= devclass_get_maxunit(pcm_devclass))
return;
cont = 1;
diff --git a/sys/dev/sound/pcm/sndstat.c b/sys/dev/sound/pcm/sndstat.c
index 25c71ed..a16c07e 100644
--- a/sys/dev/sound/pcm/sndstat.c
+++ b/sys/dev/sound/pcm/sndstat.c
@@ -140,7 +140,7 @@ sndstat_prepare(struct sbuf *s)
} else
sbuf_printf(s, "Installed devices:\n");
- for (i = 0; i <= devclass_get_maxunit(pcm_devclass); i++) {
+ for (i = 0; i < devclass_get_maxunit(pcm_devclass); i++) {
d = devclass_get_softc(pcm_devclass, i);
if (!d)
continue;
diff --git a/sys/dev/sound/pcm/sound.c b/sys/dev/sound/pcm/sound.c
index 89cd4d0..baf90e0 100644
--- a/sys/dev/sound/pcm/sound.c
+++ b/sys/dev/sound/pcm/sound.c
@@ -163,7 +163,7 @@ sysctl_hw_sndunit(SYSCTL_HANDLER_ARGS)
unit = snd_unit;
error = sysctl_handle_int(oidp, &unit, sizeof(unit), req);
if (error == 0 && req->newptr != NULL) {
- if (unit < 0 || unit > devclass_get_maxunit(pcm_devclass))
+ if (unit < 0 || unit >= devclass_get_maxunit(pcm_devclass))
return EINVAL;
d = devclass_get_softc(pcm_devclass, unit);
if (d == NULL || SLIST_EMPTY(&d->channels))
OpenPOWER on IntegriCloud