Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 24 Nov 2025 13:35:37 +0000
From:      Christos Margiolis <christos@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Cc:        Nicolas Provost <dev@nicolas-provost.fr>
Subject:   git: 8f8b8e4af91d - main - sound: Fix revents in midi_poll()
Message-ID:  <69245f29.26f9a.69f58ba6@gitrepo.freebsd.org>

index | next in thread | raw e-mail

The branch main has been updated by christos:

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

commit 8f8b8e4af91d4e158caf6ba4b728482311bfc7c3
Author:     Nicolas Provost <dev@nicolas-provost.fr>
AuthorDate: 2025-11-24 13:35:08 +0000
Commit:     Christos Margiolis <christos@FreeBSD.org>
CommitDate: 2025-11-24 13:35:08 +0000

    sound: Fix revents in midi_poll()
    
    Sponsored by:   The FreeBSD Foundation
    MFC after:      1 week
    Reviewed by:    christos
    Pull Request:   https://github.com/freebsd/freebsd-src/pull/1887
---
 sys/dev/sound/midi/midi.c | 20 +++++++++-----------
 1 file changed, 9 insertions(+), 11 deletions(-)

diff --git a/sys/dev/sound/midi/midi.c b/sys/dev/sound/midi/midi.c
index e14a28557406..cca7b93abf5f 100644
--- a/sys/dev/sound/midi/midi.c
+++ b/sys/dev/sound/midi/midi.c
@@ -658,21 +658,19 @@ midi_poll(struct cdev *i_dev, int events, struct thread *td)
 	mtx_lock(&m->lock);
 	mtx_lock(&m->qlock);
 
-	if (events & (POLLIN | POLLRDNORM))
+	if (events & (POLLIN | POLLRDNORM)) {
 		if (!MIDIQ_EMPTY(m->inq))
-			events |= events & (POLLIN | POLLRDNORM);
-
-	if (events & (POLLOUT | POLLWRNORM))
-		if (MIDIQ_AVAIL(m->outq) < m->hiwat)
-			events |= events & (POLLOUT | POLLWRNORM);
-
-	if (revents == 0) {
-		if (events & (POLLIN | POLLRDNORM))
+			revents |= events & (POLLIN | POLLRDNORM);
+		else
 			selrecord(td, &m->rsel);
-
-		if (events & (POLLOUT | POLLWRNORM))
+	}
+	if (events & (POLLOUT | POLLWRNORM)) {
+		if (MIDIQ_AVAIL(m->outq) < m->hiwat)
+			revents |= events & (POLLOUT | POLLWRNORM);
+		else
 			selrecord(td, &m->wsel);
 	}
+
 	mtx_unlock(&m->lock);
 	mtx_unlock(&m->qlock);
 


help

Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?69245f29.26f9a.69f58ba6>