diff mbox series

[v2] usb: gadget: f_uac2: Fix incorrect increment of bNumEndpoints

Message ID 1674559787-25928-1-git-send-email-quic_prashk@quicinc.com (mailing list archive)
State Superseded
Headers show
Series [v2] usb: gadget: f_uac2: Fix incorrect increment of bNumEndpoints | expand

Commit Message

Prashanth K Jan. 24, 2023, 11:29 a.m. UTC
Currently connect/disconnect of USB cable calls afunc_bind and
eventually increments the bNumEndpoints. Performing multiple
plugin/plugout will increment bNumEndpoints incorrectly, and on
the next plug-in it leads to invalid configuration of descriptor
and hence enumeration fails.

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

Fixes: 40c73b30546e ("usb: gadget: f_uac2: add adaptive sync support for capture")
Signed-off-by: Pratham Pratap <quic_ppratap@quicinc.com>
Signed-off-by: Prashanth K <quic_prashk@quicinc.com>
---
 drivers/usb/gadget/function/f_uac2.c | 1 +
 1 file changed, 1 insertion(+)

Comments

Greg KH Jan. 24, 2023, 3:36 p.m. UTC | #1
On Tue, Jan 24, 2023 at 04:59:47PM +0530, Prashanth K wrote:
> Currently connect/disconnect of USB cable calls afunc_bind and
> eventually increments the bNumEndpoints. Performing multiple
> plugin/plugout will increment bNumEndpoints incorrectly, and on
> the next plug-in it leads to invalid configuration of descriptor
> and hence enumeration fails.
> 
> Fix this by resetting the value of bNumEndpoints to 1 on every
> afunc_bind call.
> 
> Fixes: 40c73b30546e ("usb: gadget: f_uac2: add adaptive sync support for capture")
> Signed-off-by: Pratham Pratap <quic_ppratap@quicinc.com>
> Signed-off-by: Prashanth K <quic_prashk@quicinc.com>
> ---
>  drivers/usb/gadget/function/f_uac2.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/usb/gadget/function/f_uac2.c b/drivers/usb/gadget/function/f_uac2.c
> index 08726e4..0219cd7 100644
> --- a/drivers/usb/gadget/function/f_uac2.c
> +++ b/drivers/usb/gadget/function/f_uac2.c
> @@ -1142,6 +1142,7 @@ afunc_bind(struct usb_configuration *cfg, struct usb_function *fn)
>  		}
>  		std_as_out_if0_desc.bInterfaceNumber = ret;
>  		std_as_out_if1_desc.bInterfaceNumber = ret;
> +		std_as_out_if1_desc.bNumEndpoints = 1;
>  		uac2->as_out_intf = ret;
>  		uac2->as_out_alt = 0;
>  
> -- 
> 2.7.4
> 

Hi,

This is the friendly patch-bot of Greg Kroah-Hartman.  You have sent him
a patch that has triggered this response.  He used to manually respond
to these common problems, but in order to save his sanity (he kept
writing the same thing over and over, yet to different people), I was
created.  Hopefully you will not take offence and will fix the problem
in your patch and resubmit it so that it can be accepted into the Linux
kernel tree.

You are receiving this message because of the following common error(s)
as indicated below:

- This looks like a new version of a previously submitted patch, but you
  did not list below the --- line any changes from the previous version.
  Please read the section entitled "The canonical patch format" in the
  kernel file, Documentation/process/submitting-patches.rst for what
  needs to be done here to properly describe this.

If you wish to discuss this problem further, or you have questions about
how to resolve this issue, please feel free to respond to this email and
Greg will reply once he has dug out from the pending patches received
from other developers.

thanks,

greg k-h's patch email bot
diff mbox series

Patch

diff --git a/drivers/usb/gadget/function/f_uac2.c b/drivers/usb/gadget/function/f_uac2.c
index 08726e4..0219cd7 100644
--- a/drivers/usb/gadget/function/f_uac2.c
+++ b/drivers/usb/gadget/function/f_uac2.c
@@ -1142,6 +1142,7 @@  afunc_bind(struct usb_configuration *cfg, struct usb_function *fn)
 		}
 		std_as_out_if0_desc.bInterfaceNumber = ret;
 		std_as_out_if1_desc.bInterfaceNumber = ret;
+		std_as_out_if1_desc.bNumEndpoints = 1;
 		uac2->as_out_intf = ret;
 		uac2->as_out_alt = 0;