Skip to content

Commit

Permalink
can: m_can: fix not set can_dlc for remote frame
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Dong Aisheng authored and Marc Kleine-Budde committed Nov 18, 2014
1 parent f6a9964 commit 921f168
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions drivers/net/can/m_can/m_can.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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,
Expand Down

0 comments on commit 921f168

Please sign in to comment.