diff options
author | Sebastian Haas <dev@sebastianhaas.info> | 2011-12-22 17:58:34 -0500 |
---|---|---|
committer | Marc Kleine-Budde <mkl@pengutronix.de> | 2012-02-02 19:21:25 -0500 |
commit | 2ee6850ca0cac95101d2a36c8b186b40d4fc7311 (patch) | |
tree | 002e25689ba79cab63cdcde606c0f7f9e6b1d1da /drivers/net/can/usb | |
parent | 9a12349663061d25b49e6542d005fa7193a2cb44 (diff) |
can: ems_usb: Improved memory handling on ems_usb_start
Do not return from ems_usb_start if allocation fails. If not all URBs
could be allocated use the one already submitted.
Signed-off-by: Sebastian Haas <dev@sebastianhaas.info>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Diffstat (limited to 'drivers/net/can/usb')
-rw-r--r-- | drivers/net/can/usb/ems_usb.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/drivers/net/can/usb/ems_usb.c b/drivers/net/can/usb/ems_usb.c index 7dae64d44e83..9783e02fbc26 100644 --- a/drivers/net/can/usb/ems_usb.c +++ b/drivers/net/can/usb/ems_usb.c | |||
@@ -607,7 +607,8 @@ static int ems_usb_start(struct ems_usb *dev) | |||
607 | if (!urb) { | 607 | if (!urb) { |
608 | dev_err(netdev->dev.parent, | 608 | dev_err(netdev->dev.parent, |
609 | "No memory left for URBs\n"); | 609 | "No memory left for URBs\n"); |
610 | return -ENOMEM; | 610 | err = -ENOMEM; |
611 | break; | ||
611 | } | 612 | } |
612 | 613 | ||
613 | buf = usb_alloc_coherent(dev->udev, RX_BUFFER_SIZE, GFP_KERNEL, | 614 | buf = usb_alloc_coherent(dev->udev, RX_BUFFER_SIZE, GFP_KERNEL, |
@@ -616,7 +617,8 @@ static int ems_usb_start(struct ems_usb *dev) | |||
616 | dev_err(netdev->dev.parent, | 617 | dev_err(netdev->dev.parent, |
617 | "No memory left for USB buffer\n"); | 618 | "No memory left for USB buffer\n"); |
618 | usb_free_urb(urb); | 619 | usb_free_urb(urb); |
619 | return -ENOMEM; | 620 | err = -ENOMEM; |
621 | break; | ||
620 | } | 622 | } |
621 | 623 | ||
622 | usb_fill_bulk_urb(urb, dev->udev, usb_rcvbulkpipe(dev->udev, 2), | 624 | usb_fill_bulk_urb(urb, dev->udev, usb_rcvbulkpipe(dev->udev, 2), |