diff options
Diffstat (limited to 'drivers/net/can/sja1000/sja1000.c')
-rw-r--r-- | drivers/net/can/sja1000/sja1000.c | 12 |
1 files changed, 2 insertions, 10 deletions
diff --git a/drivers/net/can/sja1000/sja1000.c b/drivers/net/can/sja1000/sja1000.c index 96d8be4253f8..1a9c5958bbd7 100644 --- a/drivers/net/can/sja1000/sja1000.c +++ b/drivers/net/can/sja1000/sja1000.c | |||
@@ -296,11 +296,9 @@ static void sja1000_rx(struct net_device *dev) | |||
296 | uint8_t dlc; | 296 | uint8_t dlc; |
297 | int i; | 297 | int i; |
298 | 298 | ||
299 | skb = dev_alloc_skb(sizeof(struct can_frame)); | 299 | skb = alloc_can_skb(dev, &cf); |
300 | if (skb == NULL) | 300 | if (skb == NULL) |
301 | return; | 301 | return; |
302 | skb->dev = dev; | ||
303 | skb->protocol = htons(ETH_P_CAN); | ||
304 | 302 | ||
305 | fi = priv->read_reg(priv, REG_FI); | 303 | fi = priv->read_reg(priv, REG_FI); |
306 | dlc = fi & 0x0F; | 304 | dlc = fi & 0x0F; |
@@ -351,15 +349,9 @@ static int sja1000_err(struct net_device *dev, uint8_t isrc, uint8_t status) | |||
351 | enum can_state state = priv->can.state; | 349 | enum can_state state = priv->can.state; |
352 | uint8_t ecc, alc; | 350 | uint8_t ecc, alc; |
353 | 351 | ||
354 | skb = dev_alloc_skb(sizeof(struct can_frame)); | 352 | skb = alloc_can_err_skb(dev, &cf); |
355 | if (skb == NULL) | 353 | if (skb == NULL) |
356 | return -ENOMEM; | 354 | return -ENOMEM; |
357 | skb->dev = dev; | ||
358 | skb->protocol = htons(ETH_P_CAN); | ||
359 | cf = (struct can_frame *)skb_put(skb, sizeof(struct can_frame)); | ||
360 | memset(cf, 0, sizeof(struct can_frame)); | ||
361 | cf->can_id = CAN_ERR_FLAG; | ||
362 | cf->can_dlc = CAN_ERR_DLC; | ||
363 | 355 | ||
364 | if (isrc & IRQ_DOI) { | 356 | if (isrc & IRQ_DOI) { |
365 | /* data overrun interrupt */ | 357 | /* data overrun interrupt */ |