@@ -1323,6 +1323,14 @@ static void lan78xx_init_mac_address(struct lan78xx_net *dev)
u32 addr_lo, addr_hi;
int ret;
u8 addr[6];
+ const u8 *mac_addr;
+
+ /* maybe the boot loader passed the MAC address in devicetree */
+ mac_addr = of_get_mac_address(dev->udev->dev.of_node);
+ if (mac_addr) {
+ ether_addr_copy(addr, mac_addr);
+ goto set_mac_addr;
+ }
ret = lan78xx_read_reg(dev, RX_ADDRL, &addr_lo);
ret = lan78xx_read_reg(dev, RX_ADDRH, &addr_hi);
@@ -1335,15 +1343,6 @@ static void lan78xx_init_mac_address(struct lan78xx_net *dev)
addr[5] = (addr_hi >> 8) & 0xFF;
if (!is_valid_ether_addr(addr)) {
- const u8 *mac_addr;
-
- /* maybe the boot loader passed the MAC address in devicetree */
- mac_addr = of_get_mac_address(dev->udev->dev.of_node);
- if (mac_addr) {
- ether_addr_copy(addr, mac_addr);
- goto set_mac_addr;
- }
-
/* reading mac address from EEPROM or OTP */
if ((lan78xx_read_eeprom(dev, EEPROM_MAC_OFFSET, ETH_ALEN,
addr) == 0) ||
BugLink: http://bugs.launchpad.net/bugs/1802320 This reverts commit 17f23a96597810ddd56b0c10584fce77d7c3707f. Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com> --- drivers/net/usb/lan78xx.c | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-)