Commit 164d7cb2 authored by Vincent Mailhol's avatar Vincent Mailhol Committed by Marc Kleine-Budde

can: sja1000: 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: 215db185 ("can: sja1000: Consolidate and unify state change handling")
Link: https://lore.kernel.org/all/20220719143550.3681-4-mailhol.vincent@wanadoo.frSigned-off-by: default avatarVincent Mailhol <mailhol.vincent@wanadoo.fr>
Signed-off-by: default avatarMarc Kleine-Budde <mkl@pengutronix.de>
parent a37b7245
...@@ -404,9 +404,6 @@ static int sja1000_err(struct net_device *dev, uint8_t isrc, uint8_t status) ...@@ -404,9 +404,6 @@ static int sja1000_err(struct net_device *dev, uint8_t isrc, uint8_t status)
txerr = priv->read_reg(priv, SJA1000_TXERR); txerr = priv->read_reg(priv, SJA1000_TXERR);
rxerr = priv->read_reg(priv, SJA1000_RXERR); rxerr = priv->read_reg(priv, SJA1000_RXERR);
cf->data[6] = txerr;
cf->data[7] = rxerr;
if (isrc & IRQ_DOI) { if (isrc & IRQ_DOI) {
/* data overrun interrupt */ /* data overrun interrupt */
netdev_dbg(dev, "data overrun interrupt\n"); netdev_dbg(dev, "data overrun interrupt\n");
...@@ -428,6 +425,10 @@ static int sja1000_err(struct net_device *dev, uint8_t isrc, uint8_t status) ...@@ -428,6 +425,10 @@ static int sja1000_err(struct net_device *dev, uint8_t isrc, uint8_t status)
else else
state = CAN_STATE_ERROR_ACTIVE; state = CAN_STATE_ERROR_ACTIVE;
} }
if (state != CAN_STATE_BUS_OFF) {
cf->data[6] = txerr;
cf->data[7] = rxerr;
}
if (isrc & IRQ_BEI) { if (isrc & IRQ_BEI) {
/* bus error interrupt */ /* bus error interrupt */
priv->can.can_stats.bus_error++; priv->can.can_stats.bus_error++;
......
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