summaryrefslogtreecommitdiff
path: root/drivers/net/can/m_can/m_can.c
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2021-04-07 14:44:52 -0700
committerDavid S. Miller <davem@davemloft.net>2021-04-07 14:44:52 -0700
commit33b32a2984269706449ff4702682cac2dda01c7e (patch)
tree6ff99f8e83f0ed918a84f70db92889180768f39b /drivers/net/can/m_can/m_can.c
parent0854fa82c96ca37a35e954b7079c0bfd795affb1 (diff)
parentc7eb923c3caf4c6a183465cc012dc368b199a4b2 (diff)
Merge tag 'linux-can-next-for-5.13-20210407' of git://git.kernel.org/pub/scm/linux/kernel/git/mkl/linux-can-next
Marc Kleine-Budde says: ==================== pull-request: can-next 2021-04-07 this is a pull request of 6 patches for net-next/master. The first patch targets the CAN driver infrastructure, it improves the alloc_can{,fd}_skb() function to set the pointer to the CAN frame to NULL if skb allocation fails. The next patch adds missing error handling to the m_can driver's RX path (the code was introduced in -next, no need to backport). In the next patch an unused constant is removed from an enum in the c_can driver. The last 3 patches target the mcp251xfd driver. They add BQL support and try to work around a sometimes broken CRC when reading the TBC register. ==================== Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/can/m_can/m_can.c')
-rw-r--r--drivers/net/can/m_can/m_can.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/drivers/net/can/m_can/m_can.c b/drivers/net/can/m_can/m_can.c
index 890ed826a355..34073cd077e4 100644
--- a/drivers/net/can/m_can/m_can.c
+++ b/drivers/net/can/m_can/m_can.c
@@ -466,10 +466,17 @@ static void m_can_receive_skb(struct m_can_classdev *cdev,
struct sk_buff *skb,
u32 timestamp)
{
- if (cdev->is_peripheral)
- can_rx_offload_queue_sorted(&cdev->offload, skb, timestamp);
- else
+ if (cdev->is_peripheral) {
+ struct net_device_stats *stats = &cdev->net->stats;
+ int err;
+
+ err = can_rx_offload_queue_sorted(&cdev->offload, skb,
+ timestamp);
+ if (err)
+ stats->rx_fifo_errors++;
+ } else {
netif_receive_skb(skb);
+ }
}
static void m_can_read_fifo(struct net_device *dev, u32 rxfs)