Page MenuHomeFreeBSD

sound: Check sndstat_register return value
AbandonedPublic

Authored by guest-ayrton on Dec 22 2025, 5:47 AM.
Tags
None
Referenced Files
F166918350: D54337.diff
Mon, Aug 17, 6:30 PM
Unknown Object (File)
Thu, Aug 13, 11:39 AM
Unknown Object (File)
Thu, Aug 13, 12:33 AM
Unknown Object (File)
Wed, Aug 12, 12:06 PM
Unknown Object (File)
Tue, Aug 11, 2:18 PM
Unknown Object (File)
Mon, Aug 10, 7:39 PM
Unknown Object (File)
Mon, Aug 10, 12:02 PM
Unknown Object (File)
Mon, Aug 10, 8:10 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.