]> git.alsa-project.org Git - alsa-lib.git/commitdiff
seq: hw - notify if running mode / pversion ioctl fails
authorJaroslav Kysela <perex@perex.cz>
Tue, 11 Nov 2025 15:10:59 +0000 (16:10 +0100)
committerJaroslav Kysela <perex@perex.cz>
Wed, 12 Nov 2025 14:36:29 +0000 (15:36 +0100)
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
src/seq/seq_hw.c

index 29dd01fe29a45b5cdc3b1b6a7a4e90010360985a..86dcb8daac30a2f3c6dbee993d83802b22a44529 100644 (file)
@@ -541,8 +541,8 @@ int snd_seq_hw_open(snd_seq_t **handle, const char *name, int streams, int mode)
                return -errno;
        }
        if (ioctl(fd, SNDRV_SEQ_IOCTL_PVERSION, &ver) < 0) {
-               snd_errornum(SEQUENCER, "SNDRV_SEQ_IOCTL_PVERSION failed");
                ret = -errno;
+               snd_errornum(SEQUENCER, "SNDRV_SEQ_IOCTL_PVERSION failed");
                close(fd);
                return ret;
        }
@@ -553,7 +553,8 @@ int snd_seq_hw_open(snd_seq_t **handle, const char *name, int streams, int mode)
        if (SNDRV_PROTOCOL_VERSION(1, 0, 3) <= ver) {
                /* inform the protocol version we're supporting */
                unsigned int user_ver = SNDRV_SEQ_VERSION;
-               ioctl(fd, SNDRV_SEQ_IOCTL_USER_PVERSION, &user_ver);
+               if (ioctl(fd, SNDRV_SEQ_IOCTL_USER_PVERSION, &user_ver))
+                       snd_errornum(SEQUENCER, "cannot set user protocol version");
        }
        hw = calloc(1, sizeof(snd_seq_hw_t));
        if (hw == NULL) {
@@ -620,7 +621,8 @@ int snd_seq_hw_open(snd_seq_t **handle, const char *name, int streams, int mode)
                run_mode.big_endian = 0;
 #endif
                run_mode.cpu_mode = sizeof(long);
-               ioctl(fd, SNDRV_SEQ_IOCTL_RUNNING_MODE, &run_mode);
+               if (ioctl(fd, SNDRV_SEQ_IOCTL_RUNNING_MODE, &run_mode))
+                       snd_warn(SEQUENCER, "running mode cannot be set");
        }
 #endif