Unified · Split
| @@ -463,7 +463,7 @@ static int peak_usb_start(struct peak_usb_device *dev) · 462 unmodified lines | ||
| 463 | 463 | if (i < PCAN_USB_MAX_TX_URBS) { |
| 464 | 464 | if (i == 0) { |
| 465 | 465 | netdev_err(netdev, "couldn't setup any tx URB\n"); |
| 466 | − return err; | |
| 466 | + goto err_tx; | |
| 467 | 467 | } |
| 468 | 468 | |
| 469 | 469 | netdev_warn(netdev, "tx performance may be slow\n"); |
| @@ -472,7 +472,7 @@ static int peak_usb_start(struct peak_usb_device *dev) · 2 unmodified lines | ||
| 472 | 472 | if (dev->adapter->dev_start) { |
| 473 | 473 | err = dev->adapter->dev_start(dev); |
| 474 | 474 | if (err) |
| 475 | − goto failed; | |
| 475 | + goto err_adapter; | |
| 476 | 476 | } |
| 477 | 477 | |
| 478 | 478 | dev->state |= PCAN_USB_STATE_STARTED; |
| @@ -481,19 +481,26 @@ static int peak_usb_start(struct peak_usb_device *dev) · 2 unmodified lines | ||
| 481 | 481 | if (dev->adapter->dev_set_bus) { |
| 482 | 482 | err = dev->adapter->dev_set_bus(dev, 1); |
| 483 | 483 | if (err) |
| 484 | − goto failed; | |
| 484 | + goto err_adapter; | |
| 485 | 485 | } |
| 486 | 486 | |
| 487 | 487 | dev->can.state = CAN_STATE_ERROR_ACTIVE; |
| 488 | 488 | |
| 489 | 489 | return 0; |
| 490 | 490 | |
| 491 | −failed: | |
| 491 | +err_adapter: | |
| 492 | 492 | if (err == -ENODEV) |
| 493 | 493 | netif_device_detach(dev->netdev); |
| 494 | 494 | |
| 495 | 495 | netdev_warn(netdev, "couldn't submit control: %d\n", err); |
| 496 | 496 | |
| 497 | + for (i = 0; i < PCAN_USB_MAX_TX_URBS; i++) { | |
| 498 | + usb_free_urb(dev->tx_contexts[i].urb); | |
| 499 | + dev->tx_contexts[i].urb = NULL; | |
| 500 | + } | |
| 501 | +err_tx: | |
| 502 | + usb_kill_anchored_urbs(&dev->rx_submitted); | |
| 503 | + | |
| 497 | 504 | return err; |
| 498 | 505 | } |
| 499 | 506 | |