Page MenuHomeFreeBSD

sound: Standardize mixer_init() call order
AbandonedPublic

Authored by christos on Aug 21 2026, 12:41 PM.
Tags
None
Referenced Files
Unknown Object (File)
Mon, Oct 5, 1:11 AM
Unknown Object (File)
Sun, Oct 4, 2:33 PM
Unknown Object (File)
Thu, Oct 1, 12:20 PM
Unknown Object (File)
Thu, Oct 1, 11:46 AM
Unknown Object (File)
Thu, Oct 1, 11:46 AM
Unknown Object (File)
Thu, Oct 1, 11:08 AM
Unknown Object (File)
Tue, Sep 29, 5:25 PM
Unknown Object (File)
Tue, Sep 29, 6:07 AM
Subscribers

Details

Summary

Device drivers call mixer_init() in a non-standard order - some before
pcm_init(), and some after pcm_register(). However, both approaches are
potentially risky, and logically weak, since pcm_register() is supposed
to be the function that finalizes sound(4) attach.

Standardize the call ordering by moving all mixer_init() calls after
pcm_init(). This is also necessary for a follow-up patch, which expects
pcm_init() to have run first and initialized the PCM lock.

Sponsored by: The FreeBSD Foundation
MFC after: 1 month

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Skipped
Unit
Tests Skipped
Build Status
Buildable 75934
Build 72817: arc lint + arc unit

Event Timeline

Bump, including the whole commit stack.

Friendly bump (including the rest of the commit stack).

Friendly bump (including the rest of the commit stack).

I suggest you to go ahead with your changes. I suspect you are the only one who has the good understanding of the audio driver architecture. If there is any problem afterward with devfs integration, I will help.

In D59069#1371357, @kib wrote:

Friendly bump (including the rest of the commit stack).

I suggest you to go ahead with your changes. I suspect you are the only one who has the good understanding of the audio driver architecture. If there is any problem afterward with devfs integration, I will help.

+1

sys/arm/allwinner/a10_codec.c
1153

This is allocating some resources, e.g., unit number allocators. Now there are some extra error paths which make it easier to leak those resources. The problem already existed in most drivers, I think, but this makes it worse.

sys/arm/allwinner/a10_codec.c
1153

I will address the clean ups in follow-up patches.

Committed but Phab didn't close this automatically.