freebsd-dev/usr.sbin/mixer
Mark Johnston 5c2b216a1c mixer: Fix default_unit switching with mixers that have no devices
Apparently it's possible for a mixer to have no devices:

$ mixer -f /dev/mixer2
pcm2:mixer: <USB audio> at ? kld snd_uaudio (rec)
$

If this is the default sound device, an attempt to change the default
unit using mixer -d fails with a segfault because mod_dunit is called
with a NULL device pointer, which is dereferenced to get the parent
mixer.

ctl_dunit seems to be a dummy, i.e., we don't actually need it and can
simply pass the mixer to mod_dunit() directly.  This patch removes that
structure and associated indirection to fix the crash.

Reviewed by:	christos, hselasky
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D38060
2023-01-16 08:02:54 -05:00
..
Makefile Implement and use new mixer(3) library for FreeBSD. 2021-09-22 19:43:56 +02:00
Makefile.depend
mixer.8 mixer: remove volume backwards compat, add % interpretation 2022-06-17 22:50:58 -05:00
mixer.c mixer: Fix default_unit switching with mixers that have no devices 2023-01-16 08:02:54 -05:00