Skip to contentSkip to conversation

tg3: Fix bug in nvram write

PATCH Applied Michael Chan 2 participants 2 messages Apr 29, 2006 – Apr 30, 2006

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 5/6 tg3: Fix bug in nvram write

Fix bug in nvram write function. If the starting nvram address offset happens to be the last dword of the page, the NVRAM_CMD_LAST bit will not get set in the existing code. This patch fixes the bug by changing the "else if" to "if" so that the last dword condition always gets checked.

drivers/net/tg3.c +1 -1
index 97e27d8..0779544 100644
@@ -9404,7 +9404,7 @@ static int tg3_nvram_write_block_buffere
 
 	        if ((page_off == 0) || (i == 0))
 			nvram_cmd |= NVRAM_CMD_FIRST;
-		else if (page_off == (tp->nvram_pagesize - 4))
+		if (page_off == (tp->nvram_pagesize - 4))
 			nvram_cmd |= NVRAM_CMD_LAST;
 
 		if (i == (len - 4))
maintainer
#1 lore raw

From: "Michael Chan" <[email protected]>
Date: Fri, 28 Apr 2006 16:36:21 -0700

Quoted 7 lines

Fix bug in nvram write function. If the starting nvram address offset happens to be the last dword of the page, the NVRAM_CMD_LAST bit will not get set in the existing code. This patch fixes the bug by changing the "else if" to "if" so that the last dword condition always gets checked.

Good catch, applied.

Thanks.