ar71xx: only access device stats in tx handler if packets were processed
[openwrt/staging/lynxis.git] / target / linux / ar71xx / files / drivers / net / ethernet / atheros / ag71xx / ag71xx_main.c
index e8eb632c772094ad16c023d0b3e1649b1dd62cd5..72e6b32c639f39233cf76a0218886e87966dbafa 100644 (file)
@@ -999,12 +999,12 @@ static int ag71xx_tx_packets(struct ag71xx *ag, bool flush)
 
        DBG("%s: %d packets sent out\n", ag->dev->name, sent);
 
-       ag->dev->stats.tx_bytes += bytes_compl;
-       ag->dev->stats.tx_packets += sent;
-
        if (!sent)
                return 0;
 
+       ag->dev->stats.tx_bytes += bytes_compl;
+       ag->dev->stats.tx_packets += sent;
+
        netdev_completed_queue(ag->dev, sent, bytes_compl);
        if ((ring->curr - ring->dirty) < (ring_size * 3) / 4)
                netif_wake_queue(ag->dev);