Commit 921f1681 authored by Dong Aisheng's avatar Dong Aisheng Committed by Marc Kleine-Budde

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: default avatarDong Aisheng <b29396@freescale.com>
Signed-off-by: default avatarMarc Kleine-Budde <mkl@pengutronix.de>
parent f6a99649
...@@ -330,7 +330,7 @@ static void m_can_read_fifo(const struct net_device *dev, struct can_frame *cf, ...@@ -330,7 +330,7 @@ static void m_can_read_fifo(const struct net_device *dev, struct can_frame *cf,
u32 rxfs) u32 rxfs)
{ {
struct m_can_priv *priv = netdev_priv(dev); 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 */ /* calculate the fifo get index for where to read data */
fgi = (rxfs & RXFS_FGI_MASK) >> RXFS_FGI_OFF; 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, ...@@ -340,11 +340,12 @@ static void m_can_read_fifo(const struct net_device *dev, struct can_frame *cf,
else else
cf->can_id = (id >> 18) & CAN_SFF_MASK; 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) { if (id & RX_BUF_RTR) {
cf->can_id |= CAN_RTR_FLAG; cf->can_id |= CAN_RTR_FLAG;
} else { } 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, *(u32 *)(cf->data + 0) = m_can_fifo_read(priv, fgi,
M_CAN_FIFO_DATA(0)); M_CAN_FIFO_DATA(0));
*(u32 *)(cf->data + 4) = m_can_fifo_read(priv, fgi, *(u32 *)(cf->data + 4) = m_can_fifo_read(priv, fgi,
......
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