The branch main has been updated by christos:

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

commit adc1713fb13f89a6eb33f5de840c981d0e17e4b7
Author:     Christos Margiolis <[email protected]>
AuthorDate: 2024-07-06 18:22:50 +0000
Commit:     Christos Margiolis <[email protected]>
CommitDate: 2024-07-06 18:22:50 +0000

    sound: Make DSP_FIXUP_ERROR() regular code
    
    No reason to have this as a macro.
    
    While here, change the second case to an "else if" as there is no reason
    to check it if the open flags are invalid.
    
    Sponsored by:   The FreeBSD Foundation
    MFC after:      2 days
    Reviewed by:    dev_submerge.ch, markj, emaste
    Differential Revision:  https://reviews.freebsd.org/D45776
---
 sys/dev/sound/pcm/dsp.c | 16 ++++++----------
 1 file changed, 6 insertions(+), 10 deletions(-)

diff --git a/sys/dev/sound/pcm/dsp.c b/sys/dev/sound/pcm/dsp.c
index 26a2919ed1da..27c89c3231b7 100644
--- a/sys/dev/sound/pcm/dsp.c
+++ b/sys/dev/sound/pcm/dsp.c
@@ -287,15 +287,6 @@ skip:
        priv = NULL;
 }
 
-#define DSP_FIXUP_ERROR()              do {                            \
-       if (!DSP_F_VALID(flags))                                        \
-               error = EINVAL;                                         \
-       if (!DSP_F_DUPLEX(flags) &&                                     \
-           ((DSP_F_READ(flags) && d->reccount == 0) ||                 \
-           (DSP_F_WRITE(flags) && d->playcount == 0)))                 \
-               error = ENOTSUP;                                        \
-} while (0)
-
 static int
 dsp_open(struct cdev *i_dev, int flags, int mode, struct thread *td)
 {
@@ -330,7 +321,12 @@ dsp_open(struct cdev *i_dev, int flags, int mode, struct 
thread *td)
        PCM_WAIT(d);
 
        error = 0;
-       DSP_FIXUP_ERROR();
+       if (!DSP_F_VALID(flags))
+               error = EINVAL;
+       else if (!DSP_F_DUPLEX(flags) &&
+           ((DSP_F_READ(flags) && d->reccount == 0) ||
+           (DSP_F_WRITE(flags) && d->playcount == 0)))
+               error = ENOTSUP;
        if (pcm_getflags(d->dev) & SD_F_SIMPLEX) {
                if (DSP_F_DUPLEX(flags)) {
                        /*

Reply via email to