diff mbox

[net-next] net: ethernet: ax88796: support generating a random mac address

Message ID 20170525205511.22048-1-u.kleine-koenig@pengutronix.de
State Accepted, archived
Delegated to: David Miller
Headers show

Commit Message

Uwe Kleine-König May 25, 2017, 8:55 p.m. UTC
Instead of falling back to 00:00:00:00:00:00 generate a random address
if none is provided via platform data or from the the device's register
space.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
 drivers/net/ethernet/8390/ax88796.c | 6 ++++++
 1 file changed, 6 insertions(+)

Comments

Uwe Kleine-König May 25, 2017, 8:57 p.m. UTC | #1
Hello David,

On Thu, May 25, 2017 at 10:55:11PM +0200, Uwe Kleine-König wrote:
> Instead of falling back to 00:00:00:00:00:00 generate a random address
> if none is provided via platform data or from the the device's register

s/the the/the/

should I resend for this, or can you fixup at commit time (assuming this
patch is ok).

Best regards
Uwe
David Miller May 25, 2017, 9:01 p.m. UTC | #2
From: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Date: Thu, 25 May 2017 22:57:41 +0200

> Hello David,
> 
> On Thu, May 25, 2017 at 10:55:11PM +0200, Uwe Kleine-König wrote:
>> Instead of falling back to 00:00:00:00:00:00 generate a random address
>> if none is provided via platform data or from the the device's register
> 
> s/the the/the/
> 
> should I resend for this, or can you fixup at commit time (assuming this
> patch is ok).

I can fix that up.
Andrew Lunn May 25, 2017, 9:25 p.m. UTC | #3
On Thu, May 25, 2017 at 10:55:11PM +0200, Uwe Kleine-König wrote:
> Instead of falling back to 00:00:00:00:00:00 generate a random address
> if none is provided via platform data or from the the device's register
> space.
> 
> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>

Reviewed-by: Andrew Lunn <andrew@lunn.ch>

    Andrew
David Miller May 26, 2017, 6:58 p.m. UTC | #4
From: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Date: Thu, 25 May 2017 22:55:11 +0200

> Instead of falling back to 00:00:00:00:00:00 generate a random address
> if none is provided via platform data or from the the device's register
> space.
> 
> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>

Applied.
diff mbox

Patch

diff --git a/drivers/net/ethernet/8390/ax88796.c b/drivers/net/ethernet/8390/ax88796.c
index db02bc2fb4b2..05d9d3e2e92e 100644
--- a/drivers/net/ethernet/8390/ax88796.c
+++ b/drivers/net/ethernet/8390/ax88796.c
@@ -723,6 +723,12 @@  static int ax_init_dev(struct net_device *dev)
 	    ax->plat->mac_addr)
 		memcpy(dev->dev_addr, ax->plat->mac_addr, ETH_ALEN);
 
+	if (!is_valid_ether_addr(dev->dev_addr)) {
+		eth_hw_addr_random(dev);
+		dev_info(&dev->dev, "Using random MAC address: %pM\n",
+			 dev->dev_addr);
+	}
+
 	ax_reset_8390(dev);
 
 	ei_local->name = "AX88796";