Re: [PATCH] ALSA: core: Use the allocated major number with major=0

From: Bui Duc Phuc

Date: Mon Oct 12 2026 - 00:33:10 EST


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