Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

usb: gadget: f_uac2: Fix incorrect setting of bNumEndpoints

Currently afunc_bind sets std_ac_if_desc.bNumEndpoints to 1 if
controls (mute/volume) are enabled. During next afunc_bind call,
bNumEndpoints would be unchanged and incorrectly set to 1 even
if the controls aren't enabled.

Fix this by resetting the value of bNumEndpoints to 0 on every
afunc_bind call.

Fixes: eaf6cbe09920 ("usb: gadget: f_uac2: add volume and mute support")
Cc: stable <stable@kernel.org>
Signed-off-by: Prashanth K <quic_prashk@quicinc.com>
Link: https://lore.kernel.org/r/20241211115915.159864-1-quic_prashk@quicinc.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Prashanth K and committed by
Greg Kroah-Hartman
057bd54d b9711ff7

+1
+1
drivers/usb/gadget/function/f_uac2.c
··· 1185 1185 uac2->as_in_alt = 0; 1186 1186 } 1187 1187 1188 + std_ac_if_desc.bNumEndpoints = 0; 1188 1189 if (FUOUT_EN(uac2_opts) || FUIN_EN(uac2_opts)) { 1189 1190 uac2->int_ep = usb_ep_autoconfig(gadget, &fs_ep_int_desc); 1190 1191 if (!uac2->int_ep) {