From: Carolyn Wyborny Date: Wed, 4 May 2011 04:29:51 +0000 (+0000) Subject: igb: Add check for invalid size to igb_get_invariants_82575() X-Git-Tag: firefly_0821_release~7613^2~1367^2~173^2~6 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=f6b1bfd17d42f9dc1d799b7e0eed817ed75005ec;p=firefly-linux-kernel-4.4.55.git igb: Add check for invalid size to igb_get_invariants_82575() Recent commits have changed how EEPROM size is checked and if the size word is misconfigured, the driver will fail to load. This patch adds a check for invalid size word in the EEPROM and uses default size instead for 82576 parts. Reported-by: Stefan Assmann Signed-off-by: Carolyn Wyborny Tested-by: Jeff Pieper Signed-off-by: Jeff Kirsher --- diff --git a/drivers/net/igb/e1000_82575.c b/drivers/net/igb/e1000_82575.c index 0cd41c49bc17..0f563c8c5ffc 100644 --- a/drivers/net/igb/e1000_82575.c +++ b/drivers/net/igb/e1000_82575.c @@ -244,6 +244,14 @@ static s32 igb_get_invariants_82575(struct e1000_hw *hw) */ size += NVM_WORD_SIZE_BASE_SHIFT; + /* + * Check for invalid size + */ + if ((hw->mac.type == e1000_82576) && (size > 15)) { + printk("igb: The NVM size is not valid, " + "defaulting to 32K.\n"); + size = 15; + } nvm->word_size = 1 << size; if (nvm->word_size == (1 << 15)) nvm->page_size = 128;