@@ -87,6 +87,7 @@ struct iowarrior {
87
87
char chip_serial [9 ]; /* the serial number string of the chip connected */
88
88
int report_size ; /* number of bytes in a report */
89
89
u16 product_id ;
90
+ struct usb_anchor submitted ;
90
91
};
91
92
92
93
/*--------------*/
@@ -425,11 +426,13 @@ static ssize_t iowarrior_write(struct file *file,
425
426
retval = - EFAULT ;
426
427
goto error ;
427
428
}
429
+ usb_anchor_urb (int_out_urb , & dev -> submitted );
428
430
retval = usb_submit_urb (int_out_urb , GFP_KERNEL );
429
431
if (retval ) {
430
432
dev_dbg (& dev -> interface -> dev ,
431
433
"submit error %d for urb nr.%d\n" ,
432
434
retval , atomic_read (& dev -> write_busy ));
435
+ usb_unanchor_urb (int_out_urb );
433
436
goto error ;
434
437
}
435
438
/* submit was ok */
@@ -770,6 +773,8 @@ static int iowarrior_probe(struct usb_interface *interface,
770
773
iface_desc = interface -> cur_altsetting ;
771
774
dev -> product_id = le16_to_cpu (udev -> descriptor .idProduct );
772
775
776
+ init_usb_anchor (& dev -> submitted );
777
+
773
778
res = usb_find_last_int_in_endpoint (iface_desc , & dev -> int_in_endpoint );
774
779
if (res ) {
775
780
dev_err (& interface -> dev , "no interrupt-in endpoint found\n" );
@@ -885,6 +890,7 @@ static void iowarrior_disconnect(struct usb_interface *interface)
885
890
Deleting the device is postponed until close() was called.
886
891
*/
887
892
usb_kill_urb (dev -> int_in_urb );
893
+ usb_kill_anchored_urbs (& dev -> submitted );
888
894
wake_up_interruptible (& dev -> read_wait );
889
895
wake_up_interruptible (& dev -> write_wait );
890
896
mutex_unlock (& dev -> mutex );
0 commit comments