From: Alex Henrie <alexhenrie24@gmail.com>
To: alsa-devel@alsa-project.org, perex@perex.cz, tiwai@suse.de
Cc: Alex Henrie <alexhenrie24@gmail.com>
Subject: [PATCH 8/9] pcm: fix undefined bit shift in bad_pcm_state
Date: Sat, 26 Dec 2020 14:35:46 -0700 [thread overview]
Message-ID: <20201226213547.175071-9-alexhenrie24@gmail.com> (raw)
In-Reply-To: <20201226213547.175071-1-alexhenrie24@gmail.com>
Signed-off-by: Alex Henrie <alexhenrie24@gmail.com>
---
include/pcm.h | 4 +++-
src/pcm/pcm.c | 2 ++
src/pcm/pcm_local.h | 2 +-
3 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/include/pcm.h b/include/pcm.h
index e300b951..c6c5d8f8 100644
--- a/include/pcm.h
+++ b/include/pcm.h
@@ -307,7 +307,9 @@ typedef enum _snd_pcm_state {
SND_PCM_STATE_SUSPENDED,
/** Hardware is disconnected */
SND_PCM_STATE_DISCONNECTED,
- SND_PCM_STATE_LAST = SND_PCM_STATE_DISCONNECTED,
+ /** State cannot be queried */
+ SND_PCM_STATE_UNKNOWN,
+ SND_PCM_STATE_LAST = SND_PCM_STATE_UNKNOWN,
/** Private - used internally in the library - do not use*/
SND_PCM_STATE_PRIVATE1 = 1024
} snd_pcm_state_t;
diff --git a/src/pcm/pcm.c b/src/pcm/pcm.c
index 24030b31..5fafc2a0 100644
--- a/src/pcm/pcm.c
+++ b/src/pcm/pcm.c
@@ -680,6 +680,8 @@ static int pcm_state_to_error(snd_pcm_state_t state)
return -ESTRPIPE;
case SND_PCM_STATE_DISCONNECTED:
return -ENODEV;
+ case SND_PCM_STATE_UNKNOWN:
+ return -ENOSYS;
default:
return 0;
}
diff --git a/src/pcm/pcm_local.h b/src/pcm/pcm_local.h
index fe77e50d..04f89623 100644
--- a/src/pcm/pcm_local.h
+++ b/src/pcm/pcm_local.h
@@ -444,7 +444,7 @@ static inline int __snd_pcm_start(snd_pcm_t *pcm)
static inline snd_pcm_state_t __snd_pcm_state(snd_pcm_t *pcm)
{
if (!pcm->fast_ops->state)
- return -ENOSYS;
+ return SND_PCM_STATE_UNKNOWN;
return pcm->fast_ops->state(pcm->fast_op_arg);
}
--
2.29.2.368.ge46b91665e.dirty
next prev parent reply other threads:[~2020-12-26 21:40 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-12-26 21:35 [PATCH 0/9] scan-build fixes Alex Henrie
2020-12-26 21:35 ` [PATCH 1/9] conf: fix use after free in _snd_config_load_with_include Alex Henrie
2020-12-27 8:38 ` Takashi Iwai
2020-12-26 21:35 ` [PATCH 2/9] ucm: fix bad frees in get_list0 and get_list20 Alex Henrie
2020-12-27 8:38 ` Takashi Iwai
2020-12-26 21:35 ` [PATCH 3/9] rawmidi: fix memory leak in snd_rawmidi_virtual_open Alex Henrie
2020-12-27 8:38 ` Takashi Iwai
2020-12-26 21:35 ` [PATCH 4/9] confmisc: fix memory leak in snd_func_concat Alex Henrie
2020-12-27 8:26 ` Takashi Iwai
2020-12-28 1:45 ` Alex Henrie
2020-12-26 21:35 ` [PATCH 5/9] timer: fix sizeof operator mismatch in snd_timer_query_hw_open Alex Henrie
2020-12-27 8:39 ` Takashi Iwai
2020-12-26 21:35 ` [PATCH 6/9] pcm: remove dead assignments from snd_pcm_rate_(commit_area|grab_next_period) Alex Henrie
2020-12-27 8:39 ` Takashi Iwai
2020-12-26 21:35 ` [PATCH 7/9] pcm_multi: remove dead assignment from _snd_pcm_multi_open Alex Henrie
2020-12-27 8:39 ` Takashi Iwai
2020-12-26 21:35 ` Alex Henrie [this message]
2020-12-27 8:34 ` [PATCH 8/9] pcm: fix undefined bit shift in bad_pcm_state Takashi Iwai
2020-12-27 12:36 ` Jaroslav Kysela
2020-12-28 1:45 ` Alex Henrie
2020-12-26 21:35 ` [PATCH 9/9] conf: remove dead code from get_hexachar Alex Henrie
2020-12-27 8:37 ` Takashi Iwai
2020-12-27 12:25 ` Jaroslav Kysela
2020-12-28 1:42 ` Alex Henrie
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20201226213547.175071-9-alexhenrie24@gmail.com \
--to=alexhenrie24@gmail.com \
--cc=alsa-devel@alsa-project.org \
--cc=perex@perex.cz \
--cc=tiwai@suse.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox