diff options
Diffstat (limited to 'drivers/net/can')
| -rw-r--r-- | drivers/net/can/dev.c | 27 | ||||
| -rw-r--r-- | drivers/net/can/flexcan.c | 4 |
2 files changed, 15 insertions, 16 deletions
diff --git a/drivers/net/can/dev.c b/drivers/net/can/dev.c index 3b3f88ffab53..c05e4d50d43d 100644 --- a/drivers/net/can/dev.c +++ b/drivers/net/can/dev.c | |||
| @@ -480,8 +480,6 @@ EXPORT_SYMBOL_GPL(can_put_echo_skb); | |||
| 480 | struct sk_buff *__can_get_echo_skb(struct net_device *dev, unsigned int idx, u8 *len_ptr) | 480 | struct sk_buff *__can_get_echo_skb(struct net_device *dev, unsigned int idx, u8 *len_ptr) |
| 481 | { | 481 | { |
| 482 | struct can_priv *priv = netdev_priv(dev); | 482 | struct can_priv *priv = netdev_priv(dev); |
| 483 | struct sk_buff *skb = priv->echo_skb[idx]; | ||
| 484 | struct canfd_frame *cf; | ||
| 485 | 483 | ||
| 486 | if (idx >= priv->echo_skb_max) { | 484 | if (idx >= priv->echo_skb_max) { |
| 487 | netdev_err(dev, "%s: BUG! Trying to access can_priv::echo_skb out of bounds (%u/max %u)\n", | 485 | netdev_err(dev, "%s: BUG! Trying to access can_priv::echo_skb out of bounds (%u/max %u)\n", |
| @@ -489,20 +487,21 @@ struct sk_buff *__can_get_echo_skb(struct net_device *dev, unsigned int idx, u8 | |||
| 489 | return NULL; | 487 | return NULL; |
| 490 | } | 488 | } |
| 491 | 489 | ||
| 492 | if (!skb) { | 490 | if (priv->echo_skb[idx]) { |
| 493 | netdev_err(dev, "%s: BUG! Trying to echo non existing skb: can_priv::echo_skb[%u]\n", | 491 | /* Using "struct canfd_frame::len" for the frame |
| 494 | __func__, idx); | 492 | * length is supported on both CAN and CANFD frames. |
| 495 | return NULL; | 493 | */ |
| 496 | } | 494 | struct sk_buff *skb = priv->echo_skb[idx]; |
| 495 | struct canfd_frame *cf = (struct canfd_frame *)skb->data; | ||
| 496 | u8 len = cf->len; | ||
| 497 | 497 | ||
| 498 | /* Using "struct canfd_frame::len" for the frame | 498 | *len_ptr = len; |
| 499 | * length is supported on both CAN and CANFD frames. | 499 | priv->echo_skb[idx] = NULL; |
| 500 | */ | ||
| 501 | cf = (struct canfd_frame *)skb->data; | ||
| 502 | *len_ptr = cf->len; | ||
| 503 | priv->echo_skb[idx] = NULL; | ||
| 504 | 500 | ||
| 505 | return skb; | 501 | return skb; |
| 502 | } | ||
| 503 | |||
| 504 | return NULL; | ||
| 506 | } | 505 | } |
| 507 | 506 | ||
| 508 | /* | 507 | /* |
diff --git a/drivers/net/can/flexcan.c b/drivers/net/can/flexcan.c index 0f36eafe3ac1..1c66fb2ad76b 100644 --- a/drivers/net/can/flexcan.c +++ b/drivers/net/can/flexcan.c | |||
| @@ -1106,7 +1106,7 @@ static int flexcan_chip_start(struct net_device *dev) | |||
| 1106 | } | 1106 | } |
| 1107 | } else { | 1107 | } else { |
| 1108 | /* clear and invalidate unused mailboxes first */ | 1108 | /* clear and invalidate unused mailboxes first */ |
| 1109 | for (i = FLEXCAN_TX_MB_RESERVED_OFF_FIFO; i <= priv->mb_count; i++) { | 1109 | for (i = FLEXCAN_TX_MB_RESERVED_OFF_FIFO; i < priv->mb_count; i++) { |
| 1110 | mb = flexcan_get_mb(priv, i); | 1110 | mb = flexcan_get_mb(priv, i); |
| 1111 | priv->write(FLEXCAN_MB_CODE_RX_INACTIVE, | 1111 | priv->write(FLEXCAN_MB_CODE_RX_INACTIVE, |
| 1112 | &mb->can_ctrl); | 1112 | &mb->can_ctrl); |
| @@ -1432,7 +1432,7 @@ static int flexcan_setup_stop_mode(struct platform_device *pdev) | |||
| 1432 | gpr_np = of_find_node_by_phandle(phandle); | 1432 | gpr_np = of_find_node_by_phandle(phandle); |
| 1433 | if (!gpr_np) { | 1433 | if (!gpr_np) { |
| 1434 | dev_dbg(&pdev->dev, "could not find gpr node by phandle\n"); | 1434 | dev_dbg(&pdev->dev, "could not find gpr node by phandle\n"); |
| 1435 | return PTR_ERR(gpr_np); | 1435 | return -ENODEV; |
| 1436 | } | 1436 | } |
| 1437 | 1437 | ||
| 1438 | priv = netdev_priv(dev); | 1438 | priv = netdev_priv(dev); |
