From: phucduc.bui@gmail.com
To: Jaroslav Kysela <perex@perex.cz>, Takashi Iwai <tiwai@suse.com>,
cassiogabrielcontato@gmail.com,
Cezary Rojewski <cezary.rojewski@intel.com>
Cc: Cen Zhang <zzzccc427@gmail.com>,
Yilin Zhang <yilinzhang@moonshot.ai>,
linux-sound@vger.kernel.org, linux-kernel@vger.kernel.org,
bui duc phuc <phucduc.bui@gmail.com>
Subject: [PATCH] ALSA: pcm: Simplify success check in snd_pcm_open_file()
Date: Mon, 14 Sep 2026 16:52:48 +0700 [thread overview]
Message-ID: <20260914095248.33391-1-phucduc.bui@gmail.com> (raw)
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
next reply other threads:[~2026-09-14 9:53 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-14 9:52 phucduc.bui [this message]
2026-09-14 16:13 ` [PATCH] ALSA: pcm: Simplify success check in snd_pcm_open_file() Takashi Iwai
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=20260914095248.33391-1-phucduc.bui@gmail.com \
--to=phucduc.bui@gmail.com \
--cc=cassiogabrielcontato@gmail.com \
--cc=cezary.rojewski@intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-sound@vger.kernel.org \
--cc=perex@perex.cz \
--cc=tiwai@suse.com \
--cc=yilinzhang@moonshot.ai \
--cc=zzzccc427@gmail.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.