--- x/drivers/media/usb/siano/smsusb.c +++ y/drivers/media/usb/siano/smsusb.c @@ -173,11 +173,11 @@ static int smsusb_submit_urb(struct smsu return usb_submit_urb(&surb->urb, GFP_ATOMIC); } -static void smsusb_stop_streaming(struct smsusb_device_t *dev) +static void __smsusb_stop_streaming(struct smsusb_device_t *dev, int nr) { int i; - for (i = 0; i < MAX_URBS; i++) { + for (i = 0; i < nr; i++) { usb_kill_urb(&dev->surbs[i].urb); cancel_work_sync(&dev->surbs[i].wq); @@ -188,6 +188,11 @@ static void smsusb_stop_streaming(struct } } +static void smsusb_stop_streaming(struct smsusb_device_t *dev) +{ + __smsusb_stop_streaming(dev, MAX_URBS); +} + static int smsusb_start_streaming(struct smsusb_device_t *dev) { int i, rc; @@ -196,7 +201,7 @@ static int smsusb_start_streaming(struct rc = smsusb_submit_urb(dev, &dev->surbs[i]); if (rc < 0) { pr_err("smsusb_submit_urb(...) failed\n"); - smsusb_stop_streaming(dev); + __smsusb_stop_streaming(dev, i); break; } }