wil6210: fix error path in wil_tx_vring
authorVladimir Kondratiev <qca_vkondrat@qca.qualcomm.com>
Sun, 21 Jul 2013 08:34:36 +0000 (11:34 +0300)
committerJohn W. Linville <linville@tuxdriver.com>
Mon, 22 Jul 2013 20:54:44 +0000 (16:54 -0400)
Release fragments in the order of allocation; including one for skb head

Signed-off-by: Vladimir Kondratiev <qca_vkondrat@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
drivers/net/wireless/ath/wil6210/txrx.c

index 2a9d56a5fd0c797e24744a76c9715faa050854e9..e563af13740b6b6b67aadf25f822ed8089a7a0f3 100644 (file)
@@ -730,12 +730,13 @@ static int wil_tx_vring(struct wil6210_priv *wil, struct vring *vring,
        return 0;
  dma_error:
        /* unmap what we have mapped */
-       /* Note: increment @f to operate with positive index */
-       for (f++; f > 0; f--) {
+       nr_frags = f + 1; /* frags mapped + one for skb head */
+       for (f = 0; f < nr_frags; f++) {
                u16 dmalen;
-               struct wil_ctx *ctx = &vring->ctx[i];
+               struct wil_ctx *ctx;
 
                i = (swhead + f) % vring->size;
+               ctx = &vring->ctx[i];
                _d = &(vring->va[i].tx);
                *d = *_d;
                _d->dma.status = TX_DMA_STATUS_DU;