| .. | .. |
|---|
| 179 | 179 | |
|---|
| 180 | 180 | for (i = 0; i < MAX_URBS; i++) { |
|---|
| 181 | 181 | usb_kill_urb(&dev->surbs[i].urb); |
|---|
| 182 | + if (dev->surbs[i].wq.func) |
|---|
| 183 | + cancel_work_sync(&dev->surbs[i].wq); |
|---|
| 182 | 184 | |
|---|
| 183 | 185 | if (dev->surbs[i].cb) { |
|---|
| 184 | 186 | smscore_putbuffer(dev->coredev, dev->surbs[i].cb); |
|---|
| .. | .. |
|---|
| 453 | 455 | rc = smscore_register_device(¶ms, &dev->coredev, 0, mdev); |
|---|
| 454 | 456 | if (rc < 0) { |
|---|
| 455 | 457 | pr_err("smscore_register_device(...) failed, rc %d\n", rc); |
|---|
| 456 | | - smsusb_term_device(intf); |
|---|
| 457 | | -#ifdef CONFIG_MEDIA_CONTROLLER_DVB |
|---|
| 458 | | - media_device_unregister(mdev); |
|---|
| 459 | | -#endif |
|---|
| 460 | | - kfree(mdev); |
|---|
| 461 | | - return rc; |
|---|
| 458 | + goto err_unregister_device; |
|---|
| 462 | 459 | } |
|---|
| 463 | 460 | |
|---|
| 464 | 461 | smscore_set_board_id(dev->coredev, board_id); |
|---|
| .. | .. |
|---|
| 475 | 472 | rc = smsusb_start_streaming(dev); |
|---|
| 476 | 473 | if (rc < 0) { |
|---|
| 477 | 474 | pr_err("smsusb_start_streaming(...) failed\n"); |
|---|
| 478 | | - smsusb_term_device(intf); |
|---|
| 479 | | - return rc; |
|---|
| 475 | + goto err_unregister_device; |
|---|
| 480 | 476 | } |
|---|
| 481 | 477 | |
|---|
| 482 | 478 | dev->state = SMSUSB_ACTIVE; |
|---|
| .. | .. |
|---|
| 484 | 480 | rc = smscore_start_device(dev->coredev); |
|---|
| 485 | 481 | if (rc < 0) { |
|---|
| 486 | 482 | pr_err("smscore_start_device(...) failed\n"); |
|---|
| 487 | | - smsusb_term_device(intf); |
|---|
| 488 | | - return rc; |
|---|
| 483 | + goto err_unregister_device; |
|---|
| 489 | 484 | } |
|---|
| 490 | 485 | |
|---|
| 491 | 486 | pr_debug("device 0x%p created\n", dev); |
|---|
| 492 | 487 | |
|---|
| 493 | 488 | return rc; |
|---|
| 489 | + |
|---|
| 490 | +err_unregister_device: |
|---|
| 491 | + smsusb_term_device(intf); |
|---|
| 492 | +#ifdef CONFIG_MEDIA_CONTROLLER_DVB |
|---|
| 493 | + media_device_unregister(mdev); |
|---|
| 494 | +#endif |
|---|
| 495 | + kfree(mdev); |
|---|
| 496 | + return rc; |
|---|
| 494 | 497 | } |
|---|
| 495 | 498 | |
|---|
| 496 | 499 | static int smsusb_probe(struct usb_interface *intf, |
|---|