Commit 87e9af6c authored by Kurt Van Dijck's avatar Kurt Van Dijck Committed by David S. Miller

can: fix SJA1000 dlc for RTR packets

RTR frames do have a valid data length code on CAN.
The driver for SJA1000 did not handle that situation properly.
Signed-off-by: default avatarKurt Van Dijck <kurt.van.dijck@eia.be>
Acked-by: default avatarMarc Kleine-Budde <mkl@pengutronix.de>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 75bd0cbd
...@@ -346,10 +346,10 @@ static void sja1000_rx(struct net_device *dev) ...@@ -346,10 +346,10 @@ static void sja1000_rx(struct net_device *dev)
| (priv->read_reg(priv, REG_ID2) >> 5); | (priv->read_reg(priv, REG_ID2) >> 5);
} }
cf->can_dlc = get_can_dlc(fi & 0x0F);
if (fi & FI_RTR) { if (fi & FI_RTR) {
id |= CAN_RTR_FLAG; id |= CAN_RTR_FLAG;
} else { } else {
cf->can_dlc = get_can_dlc(fi & 0x0F);
for (i = 0; i < cf->can_dlc; i++) for (i = 0; i < cf->can_dlc; i++)
cf->data[i] = priv->read_reg(priv, dreg++); cf->data[i] = priv->read_reg(priv, dreg++);
} }
......
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