From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nisar Sayed Subject: [PATCH v5 net 2/3] lan78xx: Allow EEPROM write for less than MAX_EEPROM_SIZE Date: Thu, 21 Sep 2017 02:36:37 +0530 Message-ID: <20170920210638.11150-3-Nisar.Sayed@microchip.com> References: <20170920210638.11150-1-Nisar.Sayed@microchip.com> Mime-Version: 1.0 Content-Type: text/plain Cc: , To: Return-path: Received: from esa6.microchip.iphmx.com ([216.71.154.253]:39646 "EHLO esa6.microchip.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751551AbdITPoJ (ORCPT ); Wed, 20 Sep 2017 11:44:09 -0400 In-Reply-To: <20170920210638.11150-1-Nisar.Sayed@microchip.com> Sender: netdev-owner@vger.kernel.org List-ID: Allow EEPROM write for less than MAX_EEPROM_SIZE Fixes: 55d7de9de6c3 ("Microchip's LAN7800 family USB 2/3 to 10/100/1000 Ethernet device driver") Signed-off-by: Nisar Sayed --- drivers/net/usb/lan78xx.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/drivers/net/usb/lan78xx.c b/drivers/net/usb/lan78xx.c index fcf85ae37435..f8c63eec8353 100644 --- a/drivers/net/usb/lan78xx.c +++ b/drivers/net/usb/lan78xx.c @@ -1290,11 +1290,10 @@ static int lan78xx_ethtool_set_eeprom(struct net_device *netdev, if (ret) return ret; - /* Allow entire eeprom update only */ - if ((ee->magic == LAN78XX_EEPROM_MAGIC) && - (ee->offset == 0) && - (ee->len == 512) && - (data[0] == EEPROM_INDICATOR)) + /* Invalid EEPROM_INDICATOR at offset zero will result in a failure + * to load data from EEPROM + */ + if (ee->magic == LAN78XX_EEPROM_MAGIC) ret = lan78xx_write_raw_eeprom(dev, ee->offset, ee->len, data); else if ((ee->magic == LAN78XX_OTP_MAGIC) && (ee->offset == 0) && -- 2.14.1