summaryrefslogtreecommitdiffstats
path: root/drivers/net/can
diff options
context:
space:
mode:
authorDong Aisheng <b29396@freescale.com>2014-11-18 19:00:54 +0800
committerMarc Kleine-Budde <mkl@pengutronix.de>2014-11-18 21:35:04 +0100
commit921f168109d029e3b59459c3a2754f0e2a70fad3 (patch)
tree9cae8a1f1abfbf8d3e88e4fd1ba2f8df37b02d34 /drivers/net/can
parentf6a99649526370c7a88b86736c02f2a74b5b20e7 (diff)
downloadlinux-921f168109d029e3b59459c3a2754f0e2a70fad3.tar.bz2
can: m_can: fix not set can_dlc for remote frame
The original code missed to set the cf->can_dlc in the RTR case, so add it. Signed-off-by: Dong Aisheng <b29396@freescale.com> Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Diffstat (limited to 'drivers/net/can')
-rw-r--r--drivers/net/can/m_can/m_can.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/drivers/net/can/m_can/m_can.c b/drivers/net/can/m_can/m_can.c
index 214160b4c314..98f7e0ea7f6a 100644
--- a/drivers/net/can/m_can/m_can.c
+++ b/drivers/net/can/m_can/m_can.c
@@ -330,7 +330,7 @@ static void m_can_read_fifo(const struct net_device *dev, struct can_frame *cf,
u32 rxfs)
{
struct m_can_priv *priv = netdev_priv(dev);
- u32 id, fgi;
+ u32 id, fgi, dlc;
/* calculate the fifo get index for where to read data */
fgi = (rxfs & RXFS_FGI_MASK) >> RXFS_FGI_OFF;
@@ -340,11 +340,12 @@ static void m_can_read_fifo(const struct net_device *dev, struct can_frame *cf,
else
cf->can_id = (id >> 18) & CAN_SFF_MASK;
+ dlc = m_can_fifo_read(priv, fgi, M_CAN_FIFO_DLC);
+ cf->can_dlc = get_can_dlc((dlc >> 16) & 0x0F);
+
if (id & RX_BUF_RTR) {
cf->can_id |= CAN_RTR_FLAG;
} else {
- id = m_can_fifo_read(priv, fgi, M_CAN_FIFO_DLC);
- cf->can_dlc = get_can_dlc((id >> 16) & 0x0F);
*(u32 *)(cf->data + 0) = m_can_fifo_read(priv, fgi,
M_CAN_FIFO_DATA(0));
*(u32 *)(cf->data + 4) = m_can_fifo_read(priv, fgi,