summaryrefslogtreecommitdiff
path: root/drivers/net/can/sja1000/sja1000.c
diff options
context:
space:
mode:
authorAlexander Gerasiov <gq@cs.msu.su>2016-04-01 19:16:45 +0300
committerMarc Kleine-Budde <mkl@pengutronix.de>2016-05-09 11:07:28 +0200
commit3e51a3356cb2a1a35c07607f93d79484b1496bbf (patch)
treed7ed60cd25b05ca0b35be3a8531dc8d7b1f78565 /drivers/net/can/sja1000/sja1000.c
parent908578e7d5f69087241434c872f8f4a8ab70045f (diff)
can: sja1000: Fix error location forwarding
According to SJA1000 documentation the location of error is available regardless of an error type. Therefore it should always be forwarded to SocketCAN. Signed-off-by: Nikita Edward Baruzdin <nebaruzdin@lvk.cs.msu.su> Signed-off-by: Alexander GQ Gerasiov <gq@cs.msu.su> Acked-by: Oliver Hartkopp <socketcan@hartkopp.net> Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Diffstat (limited to 'drivers/net/can/sja1000/sja1000.c')
-rw-r--r--drivers/net/can/sja1000/sja1000.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/drivers/net/can/sja1000/sja1000.c b/drivers/net/can/sja1000/sja1000.c
index 8dda3b703d39..9f107798f904 100644
--- a/drivers/net/can/sja1000/sja1000.c
+++ b/drivers/net/can/sja1000/sja1000.c
@@ -438,6 +438,7 @@ static int sja1000_err(struct net_device *dev, uint8_t isrc, uint8_t status)
cf->can_id |= CAN_ERR_PROT | CAN_ERR_BUSERROR;
+ /* set error type */
switch (ecc & ECC_MASK) {
case ECC_BIT:
cf->data[2] |= CAN_ERR_PROT_BIT;
@@ -449,9 +450,12 @@ static int sja1000_err(struct net_device *dev, uint8_t isrc, uint8_t status)
cf->data[2] |= CAN_ERR_PROT_STUFF;
break;
default:
- cf->data[3] = ecc & ECC_SEG;
break;
}
+
+ /* set error location */
+ cf->data[3] = ecc & ECC_SEG;
+
/* Error occurred during transmission? */
if ((ecc & ECC_DIR) == 0)
cf->data[2] |= CAN_ERR_PROT_TX;