Skip to contentSkip to conversation

um: vector: Use %pM format specifier for MAC addresses

PATCH In review Andy Shevchenko 1 participant 2 messages Jun 3 – Aug 17 User-mode Linux (UML)

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 um: vector: Use %pM format specifier for MAC addresses

Convert to %pM instead of using custom code.

---
 arch/um/drivers/vector_kern.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)
arch/um/drivers/vector_kern.c +6 -3
index 2cc90055499a..e09c9db4f4a7 100644
@@ -1557,13 +1557,16 @@ static void vector_setup_etheraddr(struct net_device *dev, char *str)
 			"Attempt to assign an invalid ethernet address to a device disallowed\n");
 		goto random;
 	}
+
+	eth_hw_addr_set(dev, addr);
+
 	if (!is_local_ether_addr(addr)) {
+		addr[0] |= 0x02;
 		netdev_warn(dev, "Warning: Assigning a globally valid ethernet address to a device\n");
 		netdev_warn(dev, "You should set the 2nd rightmost bit in the first byte of the MAC,\n");
-		netdev_warn(dev, "i.e. %02x:%02x:%02x:%02x:%02x:%02x\n",
-			addr[0] | 0x02, addr[1], addr[2], addr[3], addr[4], addr[5]);
+		netdev_warn(dev, "i.e. %pM\n", addr);
 	}
-	eth_hw_addr_set(dev, addr);
+
 	return;
 
 random:
Signature · 1 line
2.50.1
#1 lore raw
Quoted 1 line · Andy Shevchenko

Convert to %pM instead of using custom code.

Any comments on this?

Signature · 2 lines
With Best Regards,
Andy Shevchenko