The Coverity checker discovered that i never gets any value different 
from 0 assigned.

I do not claim that this patch is correct, but if it isn't correct the 
bug is that i never gets assigned any value.

Signed-off-by: Adrian Bunk <[EMAIL PROTECTED]>

---

 drivers/net/tg3.c |   18 +++++-------------
 1 files changed, 5 insertions(+), 13 deletions(-)

--- linux-2.6.12-rc1-mm1-full/drivers/net/tg3.c.old     2005-03-22 
21:34:55.000000000 +0100
+++ linux-2.6.12-rc1-mm1-full/drivers/net/tg3.c 2005-03-22 22:08:40.000000000 
+0100
@@ -2982,7 +2982,6 @@ static int tigon3_4gb_hwbug_workaround(s
        struct sk_buff *new_skb = skb_copy(skb, GFP_ATOMIC);
        dma_addr_t new_addr;
        u32 entry = *start;
-       int i;
 
        if (!new_skb) {
                dev_kfree_skb(skb);
@@ -2999,23 +2998,16 @@ static int tigon3_4gb_hwbug_workaround(s
        *start = NEXT_TX(entry);
 
        /* Now clean up the sw ring entries. */
-       i = 0;
        while (entry != last_plus_one) {
-               int len;
+               int len = skb_headlen(skb);
 
-               if (i == 0)
-                       len = skb_headlen(skb);
-               else
-                       len = skb_shinfo(skb)->frags[i-1].size;
                pci_unmap_single(tp->pdev,
                                 pci_unmap_addr(&tp->tx_buffers[entry], 
mapping),
                                 len, PCI_DMA_TODEVICE);
-               if (i == 0) {
-                       tp->tx_buffers[entry].skb = new_skb;
-                       pci_unmap_addr_set(&tp->tx_buffers[entry], mapping, 
new_addr);
-               } else {
-                       tp->tx_buffers[entry].skb = NULL;
-               }
+
+               tp->tx_buffers[entry].skb = new_skb;
+               pci_unmap_addr_set(&tp->tx_buffers[entry], mapping, new_addr);
+
                entry = NEXT_TX(entry);
        }
 

-
To unsubscribe from this list: send the line "unsubscribe linux-net" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to