Commit 936e9059 authored by Vincent Mailhol's avatar Vincent Mailhol Committed by Marc Kleine-Budde

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: aec5fb22 ("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: default avatarVincent Mailhol <mailhol.vincent@wanadoo.fr>
Signed-off-by: default avatarMarc Kleine-Budde <mkl@pengutronix.de>
parent 0ac15a8f
......@@ -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);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment