Skip to contentSkip to conversation

r8152: Use MAC address from correct device tree node

PATCH Applied Thierry Reding 3 participants 3 messages Aug 7, 2020 – Aug 8, 2020

Subsystems (5)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 r8152: Use MAC address from correct device tree node

From: Thierry Reding <[email protected]>

Query the USB device's device tree node when looking for a MAC address. The struct device embedded into the struct net_device does not have a device tree node attached at all.

The reason why this went unnoticed is because the system where this was tested was one of the few development units that had its OTP programmed, as opposed to production systems where the MAC address is stored in a separate EEPROM and is passed via device tree by the firmware.

Fixes acb6d3771a03 ("r8152: Use MAC address from device tree if available")
---
 drivers/net/usb/r8152.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/usb/r8152.c +1 -1
index 7d39f998535d..2b02fefd094d 100644
@@ -1504,7 +1504,7 @@ static int determine_ethernet_addr(struct r8152 *tp, struct sockaddr *sa)
 
 	sa->sa_family = dev->type;
 
-	ret = eth_platform_get_mac_address(&dev->dev, sa->sa_data);
+	ret = eth_platform_get_mac_address(&tp->udev->dev, sa->sa_data);
 	if (ret < 0) {
 		if (tp->version == RTL_VER_01) {
 			ret = pla_ocp_read(tp, PLA_IDR, 8, sa->sa_data);
Signature · 1 line
2.27.0
Reviewed-by on v1 1/1
#1 lore raw
Quoted 32 lines · EJ Hsu

From: Thierry Reding <[email protected]>

Query the USB device's device tree node when looking for a MAC address. The struct device embedded into the struct net_device does not have a device tree node attached at all.

The reason why this went unnoticed is because the system where this was tested was one of the few development units that had its OTP programmed, as opposed to production systems where the MAC address is stored in a separate EEPROM and is passed via device tree by the firmware.

Fixes acb6d3771a03 ("r8152: Use MAC address from device tree if available")
---
 drivers/net/usb/r8152.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/usb/r8152.c index renamed from drivers/net/usb/r8152.c +0 -0

7d39f998535d..2b02fefd094d 100644

drivers/net/usb/r8152.c +1 -1
@@ -1504,7 +1504,7 @@ static int determine_ethernet_addr(struct r8152
 *tp, struct sockaddr *sa)
 
        sa->sa_family = dev->type;
 
-       ret = eth_platform_get_mac_address(&dev->dev, sa->sa_data);
+       ret = eth_platform_get_mac_address(&tp->udev->dev, sa->sa_data);
        if (ret < 0) {
                if (tp->version == RTL_VER_01) {
                        ret = pla_ocp_read(tp, PLA_IDR, 8, sa->sa_data);
Quoted 2 lines

--
2.27.0

--nvpublic

maintainer Applied
#2 lore raw
In reply to Thierry Reding

From: Thierry Reding <[email protected]>
Date: Fri, 7 Aug 2020 09:36:32 +0200

Quoted 6 lines

From: Thierry Reding <[email protected]>

Query the USB device's device tree node when looking for a MAC address. The struct device embedded into the struct net_device does not have a device tree node attached at all.

Quoted 8 lines

The reason why this went unnoticed is because the system where this was tested was one of the few development units that had its OTP programmed, as opposed to production systems where the MAC address is stored in a separate EEPROM and is passed via device tree by the firmware.

Fixes acb6d3771a03 ("r8152: Use MAC address from device tree if available")

Applied, thank you.