summaryrefslogtreecommitdiffstats
path: root/drivers/net/can/mcp251x.c
diff options
context:
space:
mode:
authorMarc Kleine-Budde <mkl@pengutronix.de>2010-10-21 08:37:10 +0200
committerDavid S. Miller <davem@davemloft.net>2010-10-26 19:48:59 +0200
commitb9958a951ed4f8adff9ce02c2b1cb4ede8e2aa0e (patch)
treee4769a1ceb27ec5c48fa4f3a398ea00d13333a8a /drivers/net/can/mcp251x.c
parentcan: flexcan: fix use after free of priv (diff)
downloadlinux-b9958a951ed4f8adff9ce02c2b1cb4ede8e2aa0e.tar.xz
linux-b9958a951ed4f8adff9ce02c2b1cb4ede8e2aa0e.zip
can: mcp251x: fix reception of standard RTR frames
This patch sets the missing CAN_RTR_FLAG if a standard RTR frame is received. (For extended frames the CAN_RTR_FLAG was already set correctly.) Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/can/mcp251x.c')
-rw-r--r--drivers/net/can/mcp251x.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/net/can/mcp251x.c b/drivers/net/can/mcp251x.c
index 6aadc3e32bd5..7ab534aee452 100644
--- a/drivers/net/can/mcp251x.c
+++ b/drivers/net/can/mcp251x.c
@@ -169,6 +169,7 @@
# define RXBSIDH_SHIFT 3
#define RXBSIDL(n) (((n) * 0x10) + 0x60 + RXBSIDL_OFF)
# define RXBSIDL_IDE 0x08
+# define RXBSIDL_SRR 0x10
# define RXBSIDL_EID 3
# define RXBSIDL_SHIFT 5
#define RXBEID8(n) (((n) * 0x10) + 0x60 + RXBEID8_OFF)
@@ -475,6 +476,8 @@ static void mcp251x_hw_rx(struct spi_device *spi, int buf_idx)
frame->can_id =
(buf[RXBSIDH_OFF] << RXBSIDH_SHIFT) |
(buf[RXBSIDL_OFF] >> RXBSIDL_SHIFT);
+ if (buf[RXBSIDL_OFF] & RXBSIDL_SRR)
+ frame->can_id |= CAN_RTR_FLAG;
}
/* Data length */
frame->can_dlc = get_can_dlc(buf[RXBDLC_OFF] & RXBDLC_LEN_MASK);