can: sja1000: Fix error location forwarding
authorAlexander Gerasiov <gq@cs.msu.su>
Fri, 1 Apr 2016 16:16:45 +0000 (19:16 +0300)
committerMarc Kleine-Budde <mkl@pengutronix.de>
Mon, 9 May 2016 09:07:28 +0000 (11:07 +0200)
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>
drivers/net/can/sja1000/sja1000.c

index 8dda3b703d39a1e82ce7fc6a63707e883d235313..9f107798f904b4e6771930d469b43082419df5d6 100644 (file)
@@ -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;