aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristos Margiolis <christos@FreeBSD.org>2024-10-18 08:41:16 +0000
committerChristos Margiolis <christos@FreeBSD.org>2024-10-20 11:21:06 +0000
commit7a7ba76aa6f0af34fd60b3d13d93ef28598f7e23 (patch)
tree2574d8e6daa572fd51b54444ba085ee8e8c3b2cf
parent28dc9f54efa94c3a17b7cfd98c7a51d42e57893a (diff)
sound: Do not check for NULL if sbuf is allocated with SBUF_AUTOEXTEND
Sponsored by: The FreeBSD Foundation MFC after: 2 days Reviewed by: dev_submerge.ch, markj Differential Revision: https://reviews.freebsd.org/D46846 (cherry picked from commit aaf84d0e96831cd886b8e1e4ae102b3ba703b90a)
-rw-r--r--sys/dev/sound/midi/midi.c6
-rw-r--r--sys/dev/sound/pcm/sndstat.c5
2 files changed, 2 insertions, 9 deletions
diff --git a/sys/dev/sound/midi/midi.c b/sys/dev/sound/midi/midi.c
index d2b495ea04cd..cae030519285 100644
--- a/sys/dev/sound/midi/midi.c
+++ b/sys/dev/sound/midi/midi.c
@@ -951,12 +951,8 @@ midistat_open(struct cdev *i_dev, int flags, int mode, struct thread *td)
return EBUSY;
}
midistat_isopen = 1;
- if (sbuf_new(&midistat_sbuf, NULL, 4096, SBUF_AUTOEXTEND) == NULL) {
- error = ENXIO;
- goto out;
- }
+ sbuf_new(&midistat_sbuf, NULL, 4096, SBUF_AUTOEXTEND);
error = (midistat_prepare(&midistat_sbuf) > 0) ? 0 : ENOMEM;
-out:
if (error)
midistat_isopen = 0;
midistat_unlock();
diff --git a/sys/dev/sound/pcm/sndstat.c b/sys/dev/sound/pcm/sndstat.c
index 993ca926070f..bc51da083439 100644
--- a/sys/dev/sound/pcm/sndstat.c
+++ b/sys/dev/sound/pcm/sndstat.c
@@ -150,10 +150,7 @@ sndstat_open(struct cdev *i_dev, int flags, int mode, struct thread *td)
pf = malloc(sizeof(*pf), M_DEVBUF, M_WAITOK | M_ZERO);
- if (sbuf_new(&pf->sbuf, NULL, 4096, SBUF_AUTOEXTEND) == NULL) {
- free(pf, M_DEVBUF);
- return (ENOMEM);
- }
+ sbuf_new(&pf->sbuf, NULL, 4096, SBUF_AUTOEXTEND);
pf->fflags = flags;
TAILQ_INIT(&pf->userdev_list);