patch-2.3.26 linux/drivers/usb/ezusb.c

Next file: linux/drivers/usb/hp_scanner.c
Previous file: linux/drivers/usb/dc2xx.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.3.25/linux/drivers/usb/ezusb.c linux/drivers/usb/ezusb.c
@@ -311,7 +311,7 @@
 		if (pos + len > 0x10000)
 			len = 0x10000 - pos;
 		i = usb_control_msg(ez->usbdev, usb_rcvctrlpipe(ez->usbdev, 0), 0xa0, 0xc0, pos, 0, b, len, HZ);
-		if (i) {
+		if (i < 0) {
 			up(&ez->mutex);
 			printk(KERN_WARNING "ezusb: upload failed pos %u len %u ret %d\n", pos, len, i);
 			*ppos = pos;
@@ -366,7 +366,7 @@
 			return -EFAULT;
 		}
 		i = usb_control_msg(ez->usbdev, usb_sndctrlpipe(ez->usbdev, 0), 0xa0, 0x40, pos, 0, b, len, HZ);
-		if (i) {
+		if (i < 0) {
 			up(&ez->mutex);
 			printk(KERN_WARNING "ezusb: download failed pos %u len %u ret %d\n", pos, len, i);
 			*ppos = pos;
@@ -1052,7 +1052,9 @@
 		init_waitqueue_head(&ezusb[u].wait);
 		spin_lock_init(&ezusb[u].lock);
 	}
-	usb_register(&ezusb_driver);
+	if (usb_register(&ezusb_driver) < 0)
+		return -1;
+
         printk(KERN_INFO "ezusb: Anchorchip firmware download driver registered\n");
 	return 0;
 }

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)