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)
May 21 2026, 1:22 AM
Unknown Object (File)
May 19 2026, 8:04 PM
Unknown Object (File)
May 19 2026, 1:42 PM
Unknown Object (File)
May 18 2026, 9:59 AM
Unknown Object (File)
May 18 2026, 9:59 AM
Unknown Object (File)
May 15 2026, 2:23 AM
Unknown Object (File)
May 7 2026, 12:39 AM
Unknown Object (File)
Apr 29 2026, 11:47 PM
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.