Re: [PATCH] ALSA: core: Use the allocated major number with major=0
From: Takashi Iwai
Date: Mon Oct 12 2026 - 03:14:53 EST
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