linux-can.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 2/2] ems_usb: Improved memory handling on ems_usb_start
@ 2011-12-22 22:58 Sebastian Haas
  2012-01-31 22:04 ` Marc Kleine-Budde
  0 siblings, 1 reply; 2+ messages in thread
From: Sebastian Haas @ 2011-12-22 22:58 UTC (permalink / raw)
  To: Linux-can Mailing List; +Cc: Marc Kleine-Budde

 From 9d0d92d279255eed7f14b9fd70d1f0d181d4b301 Mon Sep 17 00:00:00 2001
From: Sebastian Haas <dev@sebastianhaas.info>
Date: Thu, 22 Dec 2011 23:27:47 +0100
Subject: [PATCH 2/2] 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>
---
  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 55ab0c4..c91c9b6 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)
  		if (!urb) {
  			dev_err(netdev->dev.parent,
  				"No memory left for URBs\n");
-			return -ENOMEM;
+			err = -ENOMEM;
+			break;
  		}

  		buf = usb_alloc_coherent(dev->udev, RX_BUFFER_SIZE, GFP_KERNEL,
@@ -616,7 +617,8 @@ static int ems_usb_start(struct ems_usb *dev)
  			dev_err(netdev->dev.parent,
  				"No memory left for USB buffer\n");
  			usb_free_urb(urb);
-			return -ENOMEM;
+			err = -ENOMEM;
+			break;
  		}

  		usb_fill_bulk_urb(urb, dev->udev, usb_rcvbulkpipe(dev->udev, 2),
-- 
1.7.5.4


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH 2/2] ems_usb: Improved memory handling on ems_usb_start
  2011-12-22 22:58 [PATCH 2/2] ems_usb: Improved memory handling on ems_usb_start Sebastian Haas
@ 2012-01-31 22:04 ` Marc Kleine-Budde
  0 siblings, 0 replies; 2+ messages in thread
From: Marc Kleine-Budde @ 2012-01-31 22:04 UTC (permalink / raw)
  To: Sebastian Haas; +Cc: Linux-can Mailing List

[-- Attachment #1: Type: text/plain, Size: 917 bytes --]

On 12/22/2011 11:58 PM, Sebastian Haas wrote:
> From 9d0d92d279255eed7f14b9fd70d1f0d181d4b301 Mon Sep 17 00:00:00 2001
> From: Sebastian Haas <dev@sebastianhaas.info>
> Date: Thu, 22 Dec 2011 23:27:47 +0100
> Subject: [PATCH 2/2] 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>

Can you please send with "git send-email" the next time. Your mailer
converts tabs to spaces. I applied your patch by hand.

Applied to can-next.
tnx Marc

-- 
Pengutronix e.K.                  | Marc Kleine-Budde           |
Industrial Linux Solutions        | Phone: +49-231-2826-924     |
Vertretung West/Dortmund          | Fax:   +49-5121-206917-5555 |
Amtsgericht Hildesheim, HRA 2686  | http://www.pengutronix.de   |


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 262 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2012-01-31 22:04 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-12-22 22:58 [PATCH 2/2] ems_usb: Improved memory handling on ems_usb_start Sebastian Haas
2012-01-31 22:04 ` Marc Kleine-Budde

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).