Re: [PATCH] USB: gadget: fix MIDI gadget jack allocation

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, 08 Nov 2011 12:15:41 +0100, Daniel Mack <zonque@xxxxxxxxx> wrote:
@@ -798,6 +779,15 @@ f_midi_bind(struct usb_configuration *c, struct usb_function *f)
               goto fail;
       midi->out_ep->driver_data = cdev;       /* claim */

+       /* allocate temporary function list */
+       midi_function = (struct usb_descriptor_header **)
+                               kzalloc(sizeof(midi_function) *
+                                       ((MAX_PORTS * 4) + 9), GFP_KERNEL);

The cast is not needed here.

Also, you might want to use kcalloc() instead.

+       if (!midi_function) {
+               status = -ENOMEM;
+               goto fail;
+       }
+
       /*
        * construct the function's descriptor set. As the number of
        * input and output MIDI ports is configurable, we have to do

--
Best regards,                                         _     _
.o. | Liege of Serenely Enlightened Majesty of      o' \,=./ `o
..o | Computer Science,  Michał “mina86” Nazarewicz    (o o)
ooo +----<email/xmpp: mpn@xxxxxxxxxx>--------------ooO--(_)--Ooo--
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux