usb: gadget: f_midi: enable use of the index parameter

The soundcard index to use for the ALSA device creation is passed as a
parameter to f_midi_bind_config(), but is assigned to midi->index only
after the call to f_midi_register_card(midi). So no matter what is passed
to f_midi_bind_config(), the actual index for snd_card_new() is always 0.
This probably works ok if at the moment of f_midi's bind there are no
other snd_cards, but if there are, it is not possible to bind f_midi.

This patch moves the assignment to a place before the call to
f_midi_register_card(midi).

Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@samsung.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
This commit is contained in:
Andrzej Pietrasiewicz 2014-10-16 13:33:25 +02:00 committed by Felipe Balbi
parent cb0a59f541
commit 6e58ed578e
1 changed files with 1 additions and 1 deletions

View File

@ -954,6 +954,7 @@ int __init f_midi_bind_config(struct usb_configuration *c,
/* set up ALSA midi devices */ /* set up ALSA midi devices */
midi->in_ports = in_ports; midi->in_ports = in_ports;
midi->out_ports = out_ports; midi->out_ports = out_ports;
midi->index = index;
status = f_midi_register_card(midi); status = f_midi_register_card(midi);
if (status < 0) if (status < 0)
goto setup_fail; goto setup_fail;
@ -966,7 +967,6 @@ int __init f_midi_bind_config(struct usb_configuration *c,
midi->func.disable = f_midi_disable; midi->func.disable = f_midi_disable;
midi->id = kstrdup(id, GFP_KERNEL); midi->id = kstrdup(id, GFP_KERNEL);
midi->index = index;
midi->buflen = buflen; midi->buflen = buflen;
midi->qlen = qlen; midi->qlen = qlen;