[1/4] Revert "lan78xx: Ignore DT MAC address if already valid"

Message ID 1541778262-11557-2-git-send-email-paolo.pisati@canonical.com
State New
Headers show
Series
  • RaspberryPi 3B+: fix ethernet leds
Related show

Commit Message

Paolo Pisati Nov. 9, 2018, 3:44 p.m.
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(-)

Patch

diff --git a/drivers/net/usb/lan78xx.c b/drivers/net/usb/lan78xx.c
index 5871f5f..4a836a4 100644
--- a/drivers/net/usb/lan78xx.c
+++ b/drivers/net/usb/lan78xx.c
@@ -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) ||