Page MenuHomeFreeBSD

sound: Check sndstat_register return value
AbandonedPublic

Authored by guest-ayrton on Mon, Dec 22, 5:47 AM.
Tags
None
Referenced Files
F140608940: D54337.id.diff
Thu, Dec 25, 10:11 PM
Unknown Object (File)
Wed, Dec 24, 12:00 PM
Unknown Object (File)
Tue, Dec 23, 10:31 AM
Unknown Object (File)
Tue, Dec 23, 7:59 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.