Linux Sound subsystem development
 help / color / mirror / Atom feed
From: phucduc.bui@gmail.com
To: Jaroslav Kysela <perex@perex.cz>, Takashi Iwai <tiwai@suse.com>
Cc: cassiogabrielcontato@gmail.com,
	Cezary Rojewski <cezary.rojewski@intel.com>,
	Mark Brown <broonie@kernel.org>, Kees Cook <kees@kernel.org>,
	linux-sound@vger.kernel.org, linux-kernel@vger.kernel.org,
	bui duc phuc <phucduc.bui@gmail.com>
Subject: [PATCH] ALSA: control: preserve snd_card_file_add() error code in snd_ctl_open()
Date: Tue,  7 Jul 2026 16:09:58 +0700	[thread overview]
Message-ID: <20260707090958.794852-1-phucduc.bui@gmail.com> (raw)

From: bui duc phuc <phucduc.bui@gmail.com>

snd_ctl_open() unconditionally overwrites the return value of
snd_card_file_add() with -ENODEV on failure, discarding the actual
error code.
This also preserves the original error code returned by
snd_card_file_add() (e.g. -ENOMEM or -ENODEV), instead of
unconditionally overwriting it with -ENODEV.
No functional change other than the returned error code in this
failure path.

Signed-off-by: bui duc phuc <phucduc.bui@gmail.com>
---
 sound/core/control.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/sound/core/control.c b/sound/core/control.c
index 0ca9fff56e51..f64b2dec746a 100644
--- a/sound/core/control.c
+++ b/sound/core/control.c
@@ -64,7 +64,6 @@ static int snd_ctl_open(struct inode *inode, struct file *file)
 	}
 	err = snd_card_file_add(card, file);
 	if (err < 0) {
-		err = -ENODEV;
 		goto __error1;
 	}
 	if (!try_module_get(card->module)) {
-- 
2.43.0


             reply	other threads:[~2026-07-07  9:10 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-07  9:09 phucduc.bui [this message]
2026-07-07 14:43 ` [PATCH] ALSA: control: preserve snd_card_file_add() error code in snd_ctl_open() Takashi Iwai
2026-07-08  2:17   ` Bui Duc Phuc

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=20260707090958.794852-1-phucduc.bui@gmail.com \
    --to=phucduc.bui@gmail.com \
    --cc=broonie@kernel.org \
    --cc=cassiogabrielcontato@gmail.com \
    --cc=cezary.rojewski@intel.com \
    --cc=kees@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-sound@vger.kernel.org \
    --cc=perex@perex.cz \
    --cc=tiwai@suse.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox