From: Takashi Iwai <tiwai@suse.de>
To: John Keeping <jkeeping@inmusicbrands.com>
Cc: linux-usb@vger.kernel.org, stable@vger.kernel.org,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Kees Cook <kees@kernel.org>,
Abdul Rahim <abdul.rahim@myyahoo.com>,
Michael Grzeschik <m.grzeschik@pengutronix.de>,
Jeff Johnson <quic_jjohnson@quicinc.com>,
Felipe Balbi <balbi@ti.com>, Daniel Mack <zonque@gmail.com>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] usb: gadget: f_midi: fix MIDI Streaming descriptor lengths
Date: Wed, 29 Jan 2025 17:40:04 +0100 [thread overview]
Message-ID: <871pwl7evv.wl-tiwai@suse.de> (raw)
In-Reply-To: <20250129160520.2485991-1-jkeeping@inmusicbrands.com>
On Wed, 29 Jan 2025 17:05:19 +0100,
John Keeping wrote:
>
> In the two loops before setting the MIDIStreaming descriptors,
> ms_in_desc.baAssocJackID[] has entries written for "in_ports" values and
> ms_out_desc.baAssocJackID[] has entries written for "out_ports" values.
> But the counts and lengths are set the other way round in the
> descriptors.
>
> Fix the descriptors so that the bNumEmbMIDIJack values and the
> descriptor lengths match the number of entries populated in the trailing
> arrays.
Are you sure that it's a correct change?
IIUC, the in_ports and out_ports parameters are for external IN and
OUT jacks, where an external OUT jack is connected to an embedded IN
jack, and an external IN jack is connected to an embedded OUT jack.
thanks,
Takashi
>
> Cc: stable@vger.kernel.org
> Fixes: c8933c3f79568 ("USB: gadget: f_midi: allow a dynamic number of input and output ports")
> Signed-off-by: John Keeping <jkeeping@inmusicbrands.com>
> ---
> drivers/usb/gadget/function/f_midi.c | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/usb/gadget/function/f_midi.c b/drivers/usb/gadget/function/f_midi.c
> index 837fcdfa3840f..6cc3d86cb4774 100644
> --- a/drivers/usb/gadget/function/f_midi.c
> +++ b/drivers/usb/gadget/function/f_midi.c
> @@ -1000,11 +1000,11 @@ static int f_midi_bind(struct usb_configuration *c, struct usb_function *f)
> }
>
> /* configure the endpoint descriptors ... */
> - ms_out_desc.bLength = USB_DT_MS_ENDPOINT_SIZE(midi->in_ports);
> - ms_out_desc.bNumEmbMIDIJack = midi->in_ports;
> + ms_out_desc.bLength = USB_DT_MS_ENDPOINT_SIZE(midi->out_ports);
> + ms_out_desc.bNumEmbMIDIJack = midi->out_ports;
>
> - ms_in_desc.bLength = USB_DT_MS_ENDPOINT_SIZE(midi->out_ports);
> - ms_in_desc.bNumEmbMIDIJack = midi->out_ports;
> + ms_in_desc.bLength = USB_DT_MS_ENDPOINT_SIZE(midi->in_ports);
> + ms_in_desc.bNumEmbMIDIJack = midi->in_ports;
>
> /* ... and add them to the list */
> endpoint_descriptor_index = i;
> --
> 2.48.1
>
>
next prev parent reply other threads:[~2025-01-29 16:40 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-01-29 16:05 [PATCH] usb: gadget: f_midi: fix MIDI Streaming descriptor lengths John Keeping
2025-01-29 16:40 ` Takashi Iwai [this message]
2025-01-29 17:31 ` John Keeping
2025-01-30 10:50 ` Takashi Iwai
2025-01-30 10:59 ` John Keeping
2025-01-30 12:17 ` Takashi Iwai
2025-01-30 17:10 ` John Keeping
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=871pwl7evv.wl-tiwai@suse.de \
--to=tiwai@suse.de \
--cc=abdul.rahim@myyahoo.com \
--cc=balbi@ti.com \
--cc=gregkh@linuxfoundation.org \
--cc=jkeeping@inmusicbrands.com \
--cc=kees@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=m.grzeschik@pengutronix.de \
--cc=quic_jjohnson@quicinc.com \
--cc=stable@vger.kernel.org \
--cc=zonque@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox