Skip to content

Commit

Permalink
can: restart device even if dev_alloc_skb() fails
Browse files Browse the repository at this point in the history
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 <[email protected]>
Signed-off-by: Wolfgang Grandegger <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
  • Loading branch information
grandwolf authored and davem330 committed Jul 20, 2009
1 parent e237290 commit b3d0df7
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions drivers/net/can/dev.c
Original file line number Diff line number Diff line change
Expand Up @@ -346,7 +346,7 @@ void can_restart(unsigned long data)
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);
Expand All @@ -361,13 +361,13 @@ void can_restart(unsigned long data)
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);
Expand Down

0 comments on commit b3d0df7

Please sign in to comment.