can: at91_can: don't copy data to rx'ed RTR frames
authorMarc Kleine-Budde <mkl@pengutronix.de>
Thu, 21 Oct 2010 16:39:26 +0000 (18:39 +0200)
committerMarc Kleine-Budde <mkl@pengutronix.de>
Mon, 6 Jun 2011 09:00:10 +0000 (11:00 +0200)
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Acked-by: Wolfgang Grandegger <wg@grandegger.com>
drivers/net/can/at91_can.c

index afd0f5d394b0a561d6c79f4994db918bbe34589c..5358d7059211f61e6bab862ffca68f5751d6d82b 100644 (file)
@@ -513,12 +513,14 @@ static void at91_read_mb(struct net_device *dev, unsigned int mb,
                cf->can_id = (reg_mid >> 18) & CAN_SFF_MASK;
 
        reg_msr = at91_read(priv, AT91_MSR(mb));
-       if (reg_msr & AT91_MSR_MRTR)
-               cf->can_id |= CAN_RTR_FLAG;
        cf->can_dlc = get_can_dlc((reg_msr >> 16) & 0xf);
 
-       *(u32 *)(cf->data + 0) = at91_read(priv, AT91_MDL(mb));
-       *(u32 *)(cf->data + 4) = at91_read(priv, AT91_MDH(mb));
+       if (reg_msr & AT91_MSR_MRTR)
+               cf->can_id |= CAN_RTR_FLAG;
+       else {
+               *(u32 *)(cf->data + 0) = at91_read(priv, AT91_MDL(mb));
+               *(u32 *)(cf->data + 4) = at91_read(priv, AT91_MDH(mb));
+       }
 
        /* allow RX of extended frames */
        at91_write(priv, AT91_MID(mb), AT91_MID_MIDE);