summaryrefslogtreecommitdiffstats
path: root/drivers/net/tg3.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/tg3.c')
-rw-r--r--drivers/net/tg3.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/drivers/net/tg3.c b/drivers/net/tg3.c
index a4fbe4f85ffe..0d0deaae5f4c 100644
--- a/drivers/net/tg3.c
+++ b/drivers/net/tg3.c
@@ -12415,14 +12415,18 @@ skip_phy_reset:
12415 12415
12416static void __devinit tg3_read_vpd(struct tg3 *tp) 12416static void __devinit tg3_read_vpd(struct tg3 *tp)
12417{ 12417{
12418 u8 vpd_data[TG3_NVM_VPD_LEN]; 12418 u8 *vpd_data;
12419 unsigned int block_end, rosize, len; 12419 unsigned int block_end, rosize, len;
12420 int j, i = 0; 12420 int j, i = 0;
12421 u32 magic; 12421 u32 magic;
12422 12422
12423 if ((tp->tg3_flags3 & TG3_FLG3_NO_NVRAM) || 12423 if ((tp->tg3_flags3 & TG3_FLG3_NO_NVRAM) ||
12424 tg3_nvram_read(tp, 0x0, &magic)) 12424 tg3_nvram_read(tp, 0x0, &magic))
12425 goto out_not_found; 12425 goto out_no_vpd;
12426
12427 vpd_data = kmalloc(TG3_NVM_VPD_LEN, GFP_KERNEL);
12428 if (!vpd_data)
12429 goto out_no_vpd;
12426 12430
12427 if (magic == TG3_EEPROM_MAGIC) { 12431 if (magic == TG3_EEPROM_MAGIC) {
12428 for (i = 0; i < TG3_NVM_VPD_LEN; i += 4) { 12432 for (i = 0; i < TG3_NVM_VPD_LEN; i += 4) {
@@ -12506,9 +12510,12 @@ partno:
12506 12510
12507 memcpy(tp->board_part_number, &vpd_data[i], len); 12511 memcpy(tp->board_part_number, &vpd_data[i], len);
12508 12512
12509 return;
12510
12511out_not_found: 12513out_not_found:
12514 kfree(vpd_data);
12515 if (!tp->board_part_number[0])
12516 return;
12517
12518out_no_vpd:
12512 if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5906) 12519 if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5906)
12513 strcpy(tp->board_part_number, "BCM95906"); 12520 strcpy(tp->board_part_number, "BCM95906");
12514 else if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_57780 && 12521 else if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_57780 &&