Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 18 Oct 2024 08:45:07 GMT
From:      Christos Margiolis <christos@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: aaf84d0e9683 - main - sound: Do not check for NULL if sbuf is allocated with SBUF_AUTOEXTEND
Message-ID:  <202410180845.49I8j7B0088458@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch main has been updated by christos:

URL: https://cgit.FreeBSD.org/src/commit/?id=aaf84d0e96831cd886b8e1e4ae102b3ba703b90a

commit aaf84d0e96831cd886b8e1e4ae102b3ba703b90a
Author:     Christos Margiolis <christos@FreeBSD.org>
AuthorDate: 2024-10-18 08:41:16 +0000
Commit:     Christos Margiolis <christos@FreeBSD.org>
CommitDate: 2024-10-18 08:41:16 +0000

    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
---
 sys/dev/sound/midi/midi.c   | 6 +-----
 sys/dev/sound/pcm/sndstat.c | 5 +----
 2 files changed, 2 insertions(+), 9 deletions(-)

diff --git a/sys/dev/sound/midi/midi.c b/sys/dev/sound/midi/midi.c
index c42cb1d7a90c..fbfb69de2913 100644
--- a/sys/dev/sound/midi/midi.c
+++ b/sys/dev/sound/midi/midi.c
@@ -950,12 +950,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);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202410180845.49I8j7B0088458>