Skip to content

Commit 55e8519

Browse files
Craig-J-Robertspopcornmix
authored andcommitted
Updated smsc95xx driver to check for a valid MAC address in eeprom before using smsc95xx.macaddr parameter passed on command line.
The built-in RPi adaptor will still get a MAC address based on the parameter passed on the command line as the RPi hardware does not have an eeprom, however usb->ethernet adaptors using the same driver should have an eeprom with MAC address as part of their hardware and therefore will use this meaning they don't end up with the same MAC address as the built-in RPi adaptor.
1 parent ebb4475 commit 55e8519

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

drivers/net/usb/smsc95xx.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -817,10 +817,6 @@ static int smsc95xx_is_macaddr_param(struct usbnet *dev, u8 *dev_mac)
817817

818818
static void smsc95xx_init_mac_address(struct usbnet *dev)
819819
{
820-
/* Check module parameters */
821-
if (smsc95xx_is_macaddr_param(dev, dev->net->dev_addr))
822-
return;
823-
824820
/* try reading mac address from EEPROM */
825821
if (smsc95xx_read_eeprom(dev, EEPROM_MAC_OFFSET, ETH_ALEN,
826822
dev->net->dev_addr) == 0) {
@@ -831,7 +827,11 @@ static void smsc95xx_init_mac_address(struct usbnet *dev)
831827
}
832828
}
833829

834-
/* no eeprom, or eeprom values are invalid. generate random MAC */
830+
/* Check module parameters */
831+
if (smsc95xx_is_macaddr_param(dev, dev->net->dev_addr))
832+
return;
833+
834+
/* no eeprom, or eeprom values are invalid, and no module parameter specified to set MAC. Generate random MAC */
835835
eth_hw_addr_random(dev->net);
836836
netif_dbg(dev, ifup, dev->net, "MAC address set to eth_random_addr\n");
837837
}

0 commit comments

Comments
 (0)