* [PATCH] ALSA: core: Use the allocated major number with major=0
@ 2026-10-11 22:13 Ali Ahmet Memiş
2026-10-12 4:32 ` Bui Duc Phuc
0 siblings, 1 reply; 4+ messages in thread
From: Ali Ahmet Memiş @ 2026-10-11 22:13 UTC (permalink / raw)
To: Takashi Iwai, Jaroslav Kysela; +Cc: bui duc phuc, linux-sound, linux-kernel
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
^ permalink raw reply related [flat|nested] 4+ messages in thread* Re: [PATCH] ALSA: core: Use the allocated major number with major=0
2026-10-11 22:13 [PATCH] ALSA: core: Use the allocated major number with major=0 Ali Ahmet Memiş
@ 2026-10-12 4:32 ` Bui Duc Phuc
2026-10-12 7:09 ` Takashi Iwai
0 siblings, 1 reply; 4+ messages in thread
From: Bui Duc Phuc @ 2026-10-12 4:32 UTC (permalink / raw)
To: Ali Ahmet Memiş
Cc: Takashi Iwai, Jaroslav Kysela, linux-sound, linux-kernel
Hi Ali , Takashi-san,
>
> 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.
Note that major=0 has never worked, even before bd8f21876189: the old
code treated the positive return value of register_chrdev() as an
error and failed with -EIO. bd8f21876189 only changed the symptom.
So this patch adds support for a dynamic major rather than fixing a
regression. Takashi-san, is a dynamic major something ALSA wants to
support? If not, rejecting major=0 with -EINVAL might be simpler.
If it is kept, the Fixes tag is fine since the patch depends on
bd8f21876189, but please mention in the changelog that major=0
never worked before.
Best regards,
Phuc
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH] ALSA: core: Use the allocated major number with major=0
2026-10-12 4:32 ` Bui Duc Phuc
@ 2026-10-12 7:09 ` Takashi Iwai
2026-10-12 7:45 ` Bui Duc Phuc
0 siblings, 1 reply; 4+ messages in thread
From: Takashi Iwai @ 2026-10-12 7:09 UTC (permalink / raw)
To: Bui Duc Phuc
Cc: Ali Ahmet Memiş, Takashi Iwai, Jaroslav Kysela, linux-sound,
linux-kernel
On Mon, 12 Oct 2026 06:32:47 +0200,
Bui Duc Phuc wrote:
>
> Hi Ali , Takashi-san,
>
> >
> > 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.
>
>
> Note that major=0 has never worked, even before bd8f21876189: the old
> code treated the positive return value of register_chrdev() as an
> error and failed with -EIO. bd8f21876189 only changed the symptom.
>
> So this patch adds support for a dynamic major rather than fixing a
> regression. Takashi-san, is a dynamic major something ALSA wants to
> support?
No, it's supposed to be only the fixed one.
If there is a real demand, we can extend the implementation, but I
don't know of such a request.
Takashi
> If not, rejecting major=0 with -EINVAL might be simpler.
> If it is kept, the Fixes tag is fine since the patch depends on
> bd8f21876189, but please mention in the changelog that major=0
> never worked before.
>
> Best regards,
> Phuc
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH] ALSA: core: Use the allocated major number with major=0
2026-10-12 7:09 ` Takashi Iwai
@ 2026-10-12 7:45 ` Bui Duc Phuc
0 siblings, 0 replies; 4+ messages in thread
From: Bui Duc Phuc @ 2026-10-12 7:45 UTC (permalink / raw)
To: Takashi Iwai
Cc: Ali Ahmet Memiş, Takashi Iwai, Jaroslav Kysela, linux-sound,
linux-kernel
Hi Takashi-san,
> > Note that major=0 has never worked, even before bd8f21876189: the old
> > code treated the positive return value of register_chrdev() as an
> > error and failed with -EIO. bd8f21876189 only changed the symptom.
> >
> > So this patch adds support for a dynamic major rather than fixing a
> > regression. Takashi-san, is a dynamic major something ALSA wants to
> > support?
>
> No, it's supposed to be only the fixed one.
>
> If there is a real demand, we can extend the implementation, but I
> don't know of such a request.
>
Thank you for the clarification.
Best regards,
Phuc
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2026-10-12 7:46 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-10-11 22:13 [PATCH] ALSA: core: Use the allocated major number with major=0 Ali Ahmet Memiş
2026-10-12 4:32 ` Bui Duc Phuc
2026-10-12 7:09 ` Takashi Iwai
2026-10-12 7:45 ` Bui Duc Phuc
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox