can: cc770: store echo skb before starting the transfer
authorWolfgang Grandegger <wg@grandegger.com>
Mon, 12 Dec 2011 15:07:16 +0000 (16:07 +0100)
committerMarc Kleine-Budde <mkl@pengutronix.de>
Thu, 2 Feb 2012 23:24:59 +0000 (00:24 +0100)
On slow systems and high CAN bitrates, the error message
"can_put_echo_skb: BUG! echo_skb is occupied!" did show up because
can_put_echo_skb() was called after starting the transfer.

Signed-off-by: Wolfgang Grandegger <wg@grandegger.com>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
drivers/net/can/cc770/cc770.c

index 766896747643d95c96889f01b4315559f3a0b2e7..c30f0e6f104875a3b5fad4789904d0e048504da6 100644 (file)
@@ -440,12 +440,14 @@ static netdev_tx_t cc770_start_xmit(struct sk_buff *skb, struct net_device *dev)
        for (i = 0; i < dlc; i++)
                cc770_write_reg(priv, msgobj[mo].data[i], cf->data[i]);
 
+       /* Store echo skb before starting the transfer */
+       can_put_echo_skb(skb, dev, 0);
+
        cc770_write_reg(priv, msgobj[mo].ctrl1,
                        RMTPND_RES | TXRQST_SET | CPUUPD_RES | NEWDAT_UNC);
 
        stats->tx_bytes += dlc;
 
-       can_put_echo_skb(skb, dev, 0);
 
        /*
         * HM: We had some cases of repeated IRQs so make sure the