Skip to content

Commit 118469f

Browse files
Frank Jungclausmarckleinebudde
authored andcommitted
can: esd_usb: Move mislocated storage of SJA1000_ECC_SEG bits in case of a bus error
Move the supply for cf->data[3] (bit stream position of CAN error), in case of a bus- or protocol-error, outside of the "switch (ecc & SJA1000_ECC_MASK){}"-statement, because this bit stream position is independent of the error type. Fixes: 96d8e90 ("can: Add driver for esd CAN-USB/2 device") Signed-off-by: Frank Jungclaus <[email protected]> Link: https://lore.kernel.org/all/[email protected] Signed-off-by: Marc Kleine-Budde <[email protected]>
1 parent 470ac62 commit 118469f

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

drivers/net/can/usb/esd_usb.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -286,14 +286,16 @@ static void esd_usb_rx_event(struct esd_usb_net_priv *priv,
286286
cf->data[2] |= CAN_ERR_PROT_STUFF;
287287
break;
288288
default:
289-
cf->data[3] = ecc & SJA1000_ECC_SEG;
290289
break;
291290
}
292291

293292
/* Error occurred during transmission? */
294293
if (!(ecc & SJA1000_ECC_DIR))
295294
cf->data[2] |= CAN_ERR_PROT_TX;
296295

296+
/* Bit stream position in CAN frame as the error was detected */
297+
cf->data[3] = ecc & SJA1000_ECC_SEG;
298+
297299
if (priv->can.state == CAN_STATE_ERROR_WARNING ||
298300
priv->can.state == CAN_STATE_ERROR_PASSIVE) {
299301
cf->data[1] = (txerr > rxerr) ?

0 commit comments

Comments
 (0)