All of lore.kernel.org
 help / color / mirror / Atom feed
From: Wolfgang Grandegger <wg@grandegger.com>
To: netdev@vger.kernel.org
Cc: socketcan-core@lists.berlios.de,
	Kurt Van Dijck <kurt.van.dijck@eia.be>,
	Wolfgang Grandegger <wg@grandegger.com>
Subject: [PATCH 2/3] can: restart device even if dev_alloc_skb() fails
Date: Mon, 20 Jul 2009 16:06:40 +0200	[thread overview]
Message-ID: <20090720140638.747810963@denx.de> (raw)
In-Reply-To: 20090720140638.342067093@denx.de

[-- Attachment #1: busoff-restart.patch --]
[-- Type: text/plain, Size: 1149 bytes --]

If dev_alloc_skb() failed in can_restart(), the device was left behind
in the bus-off state. This patch restarts the device nevertheless.

Signed-off-by: Kurt Van Dijck <kurt.van.dijck@eia.be>
Signed-off-by: Wolfgang Grandegger <wg@grandegger.com>
---
 drivers/net/can/dev.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Index: net-next-2.6/drivers/net/can/dev.c
===================================================================
--- net-next-2.6.orig/drivers/net/can/dev.c	2009-06-09 12:45:38.446934371 +0200
+++ net-next-2.6/drivers/net/can/dev.c	2009-07-20 16:03:19.129997395 +0200
@@ -346,7 +346,7 @@
 	skb = dev_alloc_skb(sizeof(struct can_frame));
 	if (skb == NULL) {
 		err = -ENOMEM;
-		goto out;
+		goto restart;
 	}
 	skb->dev = dev;
 	skb->protocol = htons(ETH_P_CAN);
@@ -361,13 +361,13 @@
 	stats->rx_packets++;
 	stats->rx_bytes += cf->can_dlc;
 
+restart:
 	dev_dbg(dev->dev.parent, "restarted\n");
 	priv->can_stats.restarts++;
 
 	/* Now restart the device */
 	err = priv->do_set_mode(dev, CAN_MODE_START);
 
-out:
 	netif_carrier_on(dev);
 	if (err)
 		dev_err(dev->dev.parent, "Error %d during restart", err);


  parent reply	other threads:[~2009-07-20 14:06 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-07-20 14:06 [PATCH 0/3] can: various fixes to the device driver interface Wolfgang Grandegger
2009-07-20 14:06 ` [PATCH 1/3] can: sja1000: remove duplicated includes Wolfgang Grandegger
2009-07-20 14:06 ` Wolfgang Grandegger [this message]
2009-07-20 14:06 ` [PATCH 3/3] can: switch carrier on if device was stopped while in bus-off state Wolfgang Grandegger
2009-07-20 19:28 ` [PATCH 0/3] can: various fixes to the device driver interface David Miller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20090720140638.747810963@denx.de \
    --to=wg@grandegger.com \
    --cc=kurt.van.dijck@eia.be \
    --cc=netdev@vger.kernel.org \
    --cc=socketcan-core@lists.berlios.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.