diff options
author | Vincent Mailhol <mailhol.vincent@wanadoo.fr> | 2022-07-19 16:35:45 +0200 |
---|---|---|
committer | Marc Kleine-Budde <mkl@pengutronix.de> | 2022-07-20 09:26:49 +0200 |
commit | 936e90595376e64b6247c72d3ea8b8b164b7ac96 (patch) | |
tree | ca629ed0bbc226e2794ca997f000ac5af1769d23 /drivers/net/can/usb | |
parent | can: sun4i_can: do not report txerr and rxerr during bus-off (diff) | |
download | linux-936e90595376e64b6247c72d3ea8b8b164b7ac96.tar.xz linux-936e90595376e64b6247c72d3ea8b8b164b7ac96.zip |
can: kvaser_usb_hydra: do not report txerr and rxerr during bus-off
During bus off, the error count is greater than 255 and can not fit in
a u8.
Fixes: aec5fb2268b7 ("can: kvaser_usb: Add support for Kvaser USB hydra family")
Link: https://lore.kernel.org/all/20220719143550.3681-8-mailhol.vincent@wanadoo.fr
CC: Jimmy Assarsson <extja@kvaser.com>
Signed-off-by: Vincent Mailhol <mailhol.vincent@wanadoo.fr>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Diffstat (limited to 'drivers/net/can/usb')
-rw-r--r-- | drivers/net/can/usb/kvaser_usb/kvaser_usb_hydra.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/drivers/net/can/usb/kvaser_usb/kvaser_usb_hydra.c b/drivers/net/can/usb/kvaser_usb/kvaser_usb_hydra.c index 5d70844ac030..404093468b2f 100644 --- a/drivers/net/can/usb/kvaser_usb/kvaser_usb_hydra.c +++ b/drivers/net/can/usb/kvaser_usb/kvaser_usb_hydra.c @@ -917,8 +917,10 @@ static void kvaser_usb_hydra_update_state(struct kvaser_usb_net_priv *priv, new_state < CAN_STATE_BUS_OFF) priv->can.can_stats.restarts++; - cf->data[6] = bec->txerr; - cf->data[7] = bec->rxerr; + if (new_state != CAN_STATE_BUS_OFF) { + cf->data[6] = bec->txerr; + cf->data[7] = bec->rxerr; + } netif_rx(skb); } @@ -1069,8 +1071,10 @@ kvaser_usb_hydra_error_frame(struct kvaser_usb_net_priv *priv, shhwtstamps->hwtstamp = hwtstamp; cf->can_id |= CAN_ERR_BUSERROR; - cf->data[6] = bec.txerr; - cf->data[7] = bec.rxerr; + if (new_state != CAN_STATE_BUS_OFF) { + cf->data[6] = bec.txerr; + cf->data[7] = bec.rxerr; + } netif_rx(skb); |