* [RFC: 2.6 patch] drivers/net/tg3.c: remove dead code
@ 2005-03-22 22:02 Adrian Bunk
2005-03-22 22:08 ` David S. Miller
0 siblings, 1 reply; 2+ messages in thread
From: Adrian Bunk @ 2005-03-22 22:02 UTC (permalink / raw)
To: davem, jgarzik; +Cc: linux-kernel, linux-net
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 <bunk@stusta.de>
---
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);
}
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [RFC: 2.6 patch] drivers/net/tg3.c: remove dead code
2005-03-22 22:02 [RFC: 2.6 patch] drivers/net/tg3.c: remove dead code Adrian Bunk
@ 2005-03-22 22:08 ` David S. Miller
0 siblings, 0 replies; 2+ messages in thread
From: David S. Miller @ 2005-03-22 22:08 UTC (permalink / raw)
To: Adrian Bunk; +Cc: jgarzik, linux-kernel, linux-net
On Tue, 22 Mar 2005 23:02:43 +0100
Adrian Bunk <bunk@stusta.de> wrote:
> 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.
Indeed, 'i' needs to be incremented at the end of the loop
basic block.
Good catch.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2005-03-22 22:17 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-03-22 22:02 [RFC: 2.6 patch] drivers/net/tg3.c: remove dead code Adrian Bunk
2005-03-22 22:08 ` David S. Miller
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.