From: "Ali Ahmet Memiş" <aliamemis@disroot.org>
To: Takashi Iwai <tiwai@suse.com>, Jaroslav Kysela <perex@perex.cz>
Cc: bui duc phuc <phucduc.bui@gmail.com>,
linux-sound@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH] ALSA: core: Use the allocated major number with major=0
Date: Mon, 12 Oct 2026 01:13:34 +0300 [thread overview]
Message-ID: <20261011221350.1690703-1-aliamemis@disroot.org> (raw)
Since commit bd8f21876189 ("ALSA: core: propagate actual error code from
register_chrdev"), alsa_sound_init() only treats negative values from
register_chrdev() as errors. With the major=0 module option
register_chrdev() allocates a major number dynamically and returns it
but snd_major and the devices still use 0. The devices are then
created without device numbers so no /dev/snd nodes appear and sound
is unusable.
Use the returned major number when major=0 is given.
Fixes: bd8f21876189 ("ALSA: core: propagate actual error code from register_chrdev")
Signed-off-by: Ali Ahmet Memiş <aliamemis@disroot.org>
---
sound/core/sound.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/sound/core/sound.c b/sound/core/sound.c
index 24f40763a20c..a0349a7e9495 100644
--- a/sound/core/sound.c
+++ b/sound/core/sound.c
@@ -396,7 +396,6 @@ static int __init alsa_sound_init(void)
{
int err;
- snd_major = major;
snd_ecards_limit = cards_limit;
err = register_chrdev(major, "alsa", &snd_fops);
@@ -404,6 +403,9 @@ static int __init alsa_sound_init(void)
pr_err("ALSA core: unable to register native major device number %d\n", major);
return err;
}
+ if (!major)
+ major = err;
+ snd_major = major;
err = snd_info_init();
if (err < 0) {
--
2.55.0
next reply other threads:[~2026-10-11 22:14 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-11 22:13 Ali Ahmet Memiş [this message]
2026-10-12 4:32 ` Bui Duc Phuc
2026-10-12 7:09 ` Takashi Iwai
2026-10-12 7:45 ` 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=20261011221350.1690703-1-aliamemis@disroot.org \
--to=aliamemis@disroot.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-sound@vger.kernel.org \
--cc=perex@perex.cz \
--cc=phucduc.bui@gmail.com \
--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
all inboxes | Powered by JetHome®