X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=drivers%2Fusb%2Fmisc%2Femi26.c;h=4a09b87bdd2835b20528da8748e2ea5bb5224454;hb=bfaeafcfc2242277e31cc1cfae687afaac0cd9ec;hp=1fd9cb85f4ca3aa9014e542d0a517d508dcad1e6;hpb=bf891bd65de65284f3964216fcde493dba5149db;p=linux-2.6 diff --git a/drivers/usb/misc/emi26.c b/drivers/usb/misc/emi26.c index 1fd9cb85f4..4a09b87bdd 100644 --- a/drivers/usb/misc/emi26.c +++ b/drivers/usb/misc/emi26.c @@ -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");