* [PATCH] ALSA: pcm: Simplify success check in snd_pcm_open_file()
@ 2026-09-14 9:52 phucduc.bui
2026-09-14 16:13 ` Takashi Iwai
0 siblings, 1 reply; 2+ messages in thread
From: phucduc.bui @ 2026-09-14 9:52 UTC (permalink / raw)
To: Jaroslav Kysela, Takashi Iwai, cassiogabrielcontato, Cezary Rojewski
Cc: Cen Zhang, Yilin Zhang, linux-sound, linux-kernel, bui duc phuc
From: bui duc phuc <phucduc.bui@gmail.com>
snd_pcm_open_file() returns zero on success and a negative error code
on failure. Use !err to check for a successful return instead of
checking for a non-negative value.
Signed-off-by: bui duc phuc <phucduc.bui@gmail.com>
---
sound/core/pcm_native.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/sound/core/pcm_native.c b/sound/core/pcm_native.c
index 62324282fcae..000e926a1e6a 100644
--- a/sound/core/pcm_native.c
+++ b/sound/core/pcm_native.c
@@ -2930,7 +2930,7 @@ static int snd_pcm_open(struct file *file, struct snd_pcm *pcm, int stream)
mutex_lock(&pcm->open_mutex);
while (1) {
err = snd_pcm_open_file(file, pcm, stream);
- if (err >= 0)
+ if (!err)
break;
if (err == -EAGAIN) {
if (file->f_flags & O_NONBLOCK) {
--
2.43.0
^ permalink raw reply [flat|nested] 2+ messages in thread* Re: [PATCH] ALSA: pcm: Simplify success check in snd_pcm_open_file()
2026-09-14 9:52 [PATCH] ALSA: pcm: Simplify success check in snd_pcm_open_file() phucduc.bui
@ 2026-09-14 16:13 ` Takashi Iwai
0 siblings, 0 replies; 2+ messages in thread
From: Takashi Iwai @ 2026-09-14 16:13 UTC (permalink / raw)
To: phucduc.bui
Cc: Jaroslav Kysela, Takashi Iwai, cassiogabrielcontato,
Cezary Rojewski, Cen Zhang, Yilin Zhang, linux-sound,
linux-kernel
On Mon, 14 Sep 2026 11:52:48 +0200,
phucduc.bui@gmail.com wrote:
>
> From: bui duc phuc <phucduc.bui@gmail.com>
>
> snd_pcm_open_file() returns zero on success and a negative error code
> on failure. Use !err to check for a successful return instead of
> checking for a non-negative value.
>
> Signed-off-by: bui duc phuc <phucduc.bui@gmail.com>
Applied to for-next branch now. Thanks.
Takashi
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-09-14 16:13 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-09-14 9:52 [PATCH] ALSA: pcm: Simplify success check in snd_pcm_open_file() phucduc.bui
2026-09-14 16:13 ` Takashi Iwai
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®