]> err.no Git - linux-2.6/blobdiff - drivers/usb/misc/emi26.c
usbserial: fix inconsistent lock state
[linux-2.6] / drivers / usb / misc / emi26.c
index 1fd9cb85f4ca3aa9014e542d0a517d508dcad1e6..4a09b87bdd2835b20528da8748e2ea5bb5224454 100644 (file)
@@ -1,7 +1,7 @@
 /* 
  * Emagic EMI 2|6 usb audio interface firmware loader.
  * Copyright (C) 2002
- *     Tapio Laxström (tapio.laxstrom@iptime.fi)
+ *     Tapio Laxström (tapio.laxstrom@iptime.fi)
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License, as published by
@@ -53,13 +53,12 @@ static void __exit emi26_exit (void);
 static int emi26_writememory (struct usb_device *dev, int address, unsigned char *data, int length, __u8 request)
 {
        int result;
-       unsigned char *buffer =  kmalloc (length, GFP_KERNEL);
+       unsigned char *buffer =  kmemdup(data, length, GFP_KERNEL);
 
        if (!buffer) {
                err("emi26: kmalloc(%d) failed.", length);
                return -ENOMEM;
        }
-       memcpy (buffer, data, length);
        /* Note: usb_control_msg returns negative value on error or length of the
         *               data that was written! */
        result = usb_control_msg (dev, usb_sndctrlpipe(dev, 0), request, 0x40, address, 0, buffer, length, 300);
@@ -115,6 +114,10 @@ static int emi26_load_firmware (struct usb_device *dev)
 
        /* De-assert reset (let the CPU run) */
        err = emi26_set_reset(dev,0);
+       if (err < 0) {
+               err("%s - error loading firmware: error = %d", __FUNCTION__, err);
+               goto wraperr;
+       }
        msleep(250);    /* let device settle */
 
        /* 2. We upload the FPGA firmware into the EMI
@@ -250,7 +253,7 @@ static void __exit emi26_exit (void)
 module_init(emi26_init);
 module_exit(emi26_exit);
 
-MODULE_AUTHOR("tapio laxström");
+MODULE_AUTHOR("Tapio Laxström");
 MODULE_DESCRIPTION("Emagic EMI 2|6 firmware loader.");
 MODULE_LICENSE("GPL");