f_midi_register_card() uses midi->id and midi->index, so they need to
be assigned before the function is called from f_midi_bind_config().
Move the assigment of midi->buflen and midi->qlen as well so they are
all grouped.

Compile tested only.

Signed-off-by: Daniel Mack <dan...@zonque.org>
---
 drivers/usb/gadget/function/f_midi.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/usb/gadget/function/f_midi.c 
b/drivers/usb/gadget/function/f_midi.c
index 807b31c..a83f129 100644
--- a/drivers/usb/gadget/function/f_midi.c
+++ b/drivers/usb/gadget/function/f_midi.c
@@ -954,6 +954,11 @@ int __init f_midi_bind_config(struct usb_configuration *c,
        /* set up ALSA midi devices */
        midi->in_ports = in_ports;
        midi->out_ports = out_ports;
+       midi->id = kstrdup(id, GFP_KERNEL);
+       midi->index = index;
+       midi->buflen = buflen;
+       midi->qlen = qlen;
+
        status = f_midi_register_card(midi);
        if (status < 0)
                goto setup_fail;
@@ -965,11 +970,6 @@ int __init f_midi_bind_config(struct usb_configuration *c,
        midi->func.set_alt     = f_midi_set_alt;
        midi->func.disable     = f_midi_disable;
 
-       midi->id = kstrdup(id, GFP_KERNEL);
-       midi->index = index;
-       midi->buflen = buflen;
-       midi->qlen = qlen;
-
        status = usb_add_function(c, &midi->func);
        if (status)
                goto setup_fail;
-- 
2.1.0

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to