Commit b3d0df7c authored by Wolfgang Grandegger's avatar Wolfgang Grandegger Committed by David S. Miller

can: restart device even if dev_alloc_skb() fails

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: default avatarKurt Van Dijck <kurt.van.dijck@eia.be>
Signed-off-by: default avatarWolfgang Grandegger <wg@grandegger.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent e2372902
...@@ -346,7 +346,7 @@ void can_restart(unsigned long data) ...@@ -346,7 +346,7 @@ void can_restart(unsigned long data)
skb = dev_alloc_skb(sizeof(struct can_frame)); skb = dev_alloc_skb(sizeof(struct can_frame));
if (skb == NULL) { if (skb == NULL) {
err = -ENOMEM; err = -ENOMEM;
goto out; goto restart;
} }
skb->dev = dev; skb->dev = dev;
skb->protocol = htons(ETH_P_CAN); skb->protocol = htons(ETH_P_CAN);
...@@ -361,13 +361,13 @@ void can_restart(unsigned long data) ...@@ -361,13 +361,13 @@ void can_restart(unsigned long data)
stats->rx_packets++; stats->rx_packets++;
stats->rx_bytes += cf->can_dlc; stats->rx_bytes += cf->can_dlc;
restart:
dev_dbg(dev->dev.parent, "restarted\n"); dev_dbg(dev->dev.parent, "restarted\n");
priv->can_stats.restarts++; priv->can_stats.restarts++;
/* Now restart the device */ /* Now restart the device */
err = priv->do_set_mode(dev, CAN_MODE_START); err = priv->do_set_mode(dev, CAN_MODE_START);
out:
netif_carrier_on(dev); netif_carrier_on(dev);
if (err) if (err)
dev_err(dev->dev.parent, "Error %d during restart", err); dev_err(dev->dev.parent, "Error %d during restart", err);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment