netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net] r8152: Use MAC address from correct device tree node
@ 2020-08-07  7:36 Thierry Reding
  2020-08-07  8:06 ` EJ Hsu
  2020-08-08 21:27 ` David Miller
  0 siblings, 2 replies; 3+ messages in thread
From: Thierry Reding @ 2020-08-07  7:36 UTC (permalink / raw)
  To: David S . Miller, Jakub Kicinski; +Cc: linux-usb, netdev, linux-tegra, EJ Hsu

From: Thierry Reding <treding@nvidia.com>

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.

Reported-by: EJ Hsu <ejh@nvidia.com>
Fixes: acb6d3771a03 ("r8152: Use MAC address from device tree if available")
Signed-off-by: Thierry Reding <treding@nvidia.com>
---
 drivers/net/usb/r8152.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/usb/r8152.c b/drivers/net/usb/r8152.c
index 7d39f998535d..2b02fefd094d 100644
--- a/drivers/net/usb/r8152.c
+++ b/drivers/net/usb/r8152.c
@@ -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);
-- 
2.27.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* RE: [PATCH net] r8152: Use MAC address from correct device tree node
  2020-08-07  7:36 [PATCH net] r8152: Use MAC address from correct device tree node Thierry Reding
@ 2020-08-07  8:06 ` EJ Hsu
  2020-08-08 21:27 ` David Miller
  1 sibling, 0 replies; 3+ messages in thread
From: EJ Hsu @ 2020-08-07  8:06 UTC (permalink / raw)
  To: Thierry Reding, David S . Miller, Jakub Kicinski
  Cc: linux-usb, netdev, linux-tegra

EJ Hsu wrote:

> From: Thierry Reding <treding@nvidia.com>
> 
> 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.
> 
> Reported-by: EJ Hsu <ejh@nvidia.com>
> Fixes: acb6d3771a03 ("r8152: Use MAC address from device tree if available")
> Signed-off-by: Thierry Reding <treding@nvidia.com>
> ---
>  drivers/net/usb/r8152.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/net/usb/r8152.c b/drivers/net/usb/r8152.c index
> 7d39f998535d..2b02fefd094d 100644
> --- a/drivers/net/usb/r8152.c
> +++ b/drivers/net/usb/r8152.c
> @@ -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);
> --
> 2.27.0


Reviewed-by: EJ Hsu <ejh@nvidia.com>

--nvpublic

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH net] r8152: Use MAC address from correct device tree node
  2020-08-07  7:36 [PATCH net] r8152: Use MAC address from correct device tree node Thierry Reding
  2020-08-07  8:06 ` EJ Hsu
@ 2020-08-08 21:27 ` David Miller
  1 sibling, 0 replies; 3+ messages in thread
From: David Miller @ 2020-08-08 21:27 UTC (permalink / raw)
  To: thierry.reding; +Cc: kuba, linux-usb, netdev, linux-tegra, ejh

From: Thierry Reding <thierry.reding@gmail.com>
Date: Fri,  7 Aug 2020 09:36:32 +0200

> From: Thierry Reding <treding@nvidia.com>
> 
> 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.
> 
> Reported-by: EJ Hsu <ejh@nvidia.com>
> Fixes: acb6d3771a03 ("r8152: Use MAC address from device tree if available")
> Signed-off-by: Thierry Reding <treding@nvidia.com>

Applied, thank you.


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-08-08 21:27 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-07  7:36 [PATCH net] r8152: Use MAC address from correct device tree node Thierry Reding
2020-08-07  8:06 ` EJ Hsu
2020-08-08 21:27 ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).