* [PATCH] gianfar: Use random MAC address when none is given
@ 2020-07-14 12:01 Maxim Kochetkov
2020-07-14 21:17 ` David Miller
0 siblings, 1 reply; 2+ messages in thread
From: Maxim Kochetkov @ 2020-07-14 12:01 UTC (permalink / raw)
Cc: Maxim Kochetkov, Claudiu Manoil, David S. Miller, Jakub Kicinski,
netdev, linux-kernel
If there is no valid MAC address in the device tree,
use a random MAC address.
Signed-off-by: Maxim Kochetkov <fido_max@inbox.ru>
---
drivers/net/ethernet/freescale/gianfar.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/freescale/gianfar.c b/drivers/net/ethernet/freescale/gianfar.c
index b3c69e9038ea..b513b8c5c3b5 100644
--- a/drivers/net/ethernet/freescale/gianfar.c
+++ b/drivers/net/ethernet/freescale/gianfar.c
@@ -779,8 +779,12 @@ static int gfar_of_init(struct platform_device *ofdev, struct net_device **pdev)
mac_addr = of_get_mac_address(np);
- if (!IS_ERR(mac_addr))
+ if (!IS_ERR(mac_addr)) {
ether_addr_copy(dev->dev_addr, mac_addr);
+ } else {
+ eth_hw_addr_random(dev);
+ dev_info(&ofdev->dev, "Using random MAC address: %pM\n", dev->dev_addr);
+ }
if (model && !strcasecmp(model, "TSEC"))
priv->device_flags |= FSL_GIANFAR_DEV_HAS_GIGABIT |
--
2.27.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] gianfar: Use random MAC address when none is given
2020-07-14 12:01 [PATCH] gianfar: Use random MAC address when none is given Maxim Kochetkov
@ 2020-07-14 21:17 ` David Miller
0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2020-07-14 21:17 UTC (permalink / raw)
To: fido_max; +Cc: claudiu.manoil, kuba, netdev, linux-kernel
From: Maxim Kochetkov <fido_max@inbox.ru>
Date: Tue, 14 Jul 2020 15:01:04 +0300
> If there is no valid MAC address in the device tree,
> use a random MAC address.
>
> Signed-off-by: Maxim Kochetkov <fido_max@inbox.ru>
Looks good, patch applied, thanks.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2020-07-14 21:17 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-14 12:01 [PATCH] gianfar: Use random MAC address when none is given Maxim Kochetkov
2020-07-14 21:17 ` 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).