Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c0776822 authored by Nisar Sayed's avatar Nisar Sayed Committed by David S. Miller
Browse files

lan78xx: Allow EEPROM write for less than MAX_EEPROM_SIZE



Allow EEPROM write for less than MAX_EEPROM_SIZE

Fixes: 55d7de9d ("Microchip's LAN7800 family USB 2/3 to 10/100/1000 Ethernet device driver")
Signed-off-by: default avatarNisar Sayed <Nisar.Sayed@microchip.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 8a7ffeb7
Loading
Loading
Loading
Loading
+4 −5
Original line number Original line Diff line number Diff line
@@ -1290,11 +1290,10 @@ static int lan78xx_ethtool_set_eeprom(struct net_device *netdev,
	if (ret)
	if (ret)
		return ret;
		return ret;


	/* Allow entire eeprom update only */
	/* Invalid EEPROM_INDICATOR at offset zero will result in a failure
	if ((ee->magic == LAN78XX_EEPROM_MAGIC) &&
	 * to load data from EEPROM
	    (ee->offset == 0) &&
	 */
	    (ee->len == 512) &&
	if (ee->magic == LAN78XX_EEPROM_MAGIC)
	    (data[0] == EEPROM_INDICATOR))
		ret = lan78xx_write_raw_eeprom(dev, ee->offset, ee->len, data);
		ret = lan78xx_write_raw_eeprom(dev, ee->offset, ee->len, data);
	else if ((ee->magic == LAN78XX_OTP_MAGIC) &&
	else if ((ee->magic == LAN78XX_OTP_MAGIC) &&
		 (ee->offset == 0) &&
		 (ee->offset == 0) &&