Page MenuHomeFreeBSD

sound: Check sndstat_register return value
AbandonedPublic

Authored by guest-ayrton on Dec 22 2025, 5:47 AM.
Tags
None
Referenced Files
Unknown Object (File)
Sat, Oct 10, 10:59 PM
Unknown Object (File)
Sat, Oct 10, 11:15 AM
Unknown Object (File)
Sat, Oct 10, 10:37 AM
Unknown Object (File)
Wed, Oct 7, 1:45 AM
Unknown Object (File)
Mon, Oct 5, 12:27 PM
Unknown Object (File)
Mon, Oct 5, 9:01 AM
Unknown Object (File)
Sat, Oct 3, 1:15 PM
Unknown Object (File)
Thu, Sep 24, 5:48 AM
Subscribers

Details

Summary

sndstat_register may return EINVAL if a device is not named "pcm" or "midi".
This commit makes pcm_register bubble up the error to its caller instead of
silently ignoring it and allowing a sound driver to continue initialization.
This should not affect in-tree drivers, but is useful for debugging new ones.

Test Plan

I checked that my out-of-tree virtio sound driver still works in QEMU
https://github.com/ayrtonm/freebsd-src/tree/virtio_snd

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 69436
Build 66319: arc lint + arc unit

Event Timeline

sndstat_register() always returns 0, so perhaps the change instead should be to make the function void.

Here's the branch in sndstat_register returning EINVAL
https://cgit.freebsd.org/src/tree/sys/dev/sound/pcm/sndstat.c#n1170

Oh, right. I forgot this because I already have a patch to remove this chunk (D54141). I can convert the function to void there instead.

Oh nice! I'll drop this change then.