[PATCH 3/6] can: esd_usb: Improved behavior on esd CAN_ERROR_EXT event (2)

From: Frank Jungclaus
Date: Fri Jul 08 2022 - 14:14:24 EST


Moved mislocated supply for cf->data[3] (location of CAN error)
outside of the "switch (ecc & SJA1000_ECC_MASK){}"-statement

Signed-off-by: Frank Jungclaus <frank.jungclaus@xxxxxx>
---
drivers/net/can/usb/esd_usb.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/net/can/usb/esd_usb.c b/drivers/net/can/usb/esd_usb.c
index e14f08d30b0b..0a402a23d7ac 100644
--- a/drivers/net/can/usb/esd_usb.c
+++ b/drivers/net/can/usb/esd_usb.c
@@ -294,7 +294,6 @@ static void esd_usb_rx_event(struct esd_usb_net_priv *priv,
cf->data[2] |= CAN_ERR_PROT_STUFF;
break;
default:
- cf->data[3] = ecc & SJA1000_ECC_SEG;
break;
}

@@ -302,6 +301,9 @@ static void esd_usb_rx_event(struct esd_usb_net_priv *priv,
if (!(ecc & SJA1000_ECC_DIR))
cf->data[2] |= CAN_ERR_PROT_TX;

+ /* Store error in CAN protocol (location) in data[3] */
+ cf->data[3] = ecc & SJA1000_ECC_SEG;
+
if (priv->can.state == CAN_STATE_ERROR_WARNING ||
priv->can.state == CAN_STATE_ERROR_PASSIVE) {
cf->data[1] = (txerr > rxerr) ?
--
2.25.1