Thread (5 messages) flat view 5 messages, 2 authors, 2021-04-07

Re: [PATCH net-next v3 1/2] of: net: pass the dst buffer to of_get_mac_address()

From: Michael Walle <hidden>
Date: 2021-04-07 16:10:51
Also in: linux-amlogic, linux-devicetree, linux-mediatek, linux-omap, linux-renesas-soc, linux-staging, linux-wireless, linuxppc-dev, lkml

Am 2021-04-07 00:09, schrieb Michael Walle:
[..]
quoted hunk ↗ jump to hunk
diff --git a/drivers/of/of_net.c b/drivers/of/of_net.c
index bc0a27de69d4..2d5d5e59aea5 100644
--- a/drivers/of/of_net.c
+++ b/drivers/of/of_net.c
@@ -45,42 +45,35 @@ int of_get_phy_mode(struct device_node *np,
phy_interface_t *interface)
 }
 EXPORT_SYMBOL_GPL(of_get_phy_mode);

-static const void *of_get_mac_addr(struct device_node *np, const char 
*name)
+static int of_get_mac_addr(struct device_node *np, const char *name, 
u8 *addr)
 {
 	struct property *pp = of_find_property(np, name, NULL);

-	if (pp && pp->length == ETH_ALEN && is_valid_ether_addr(pp->value))
-		return pp->value;
-	return NULL;
+	if (pp && pp->length == ETH_ALEN && is_valid_ether_addr(pp->value)) {
+		ether_addr_copy(addr, pp->value);
Mh, I guess this should rather be memcpy(addr, pp->value, ETH_ALEN) 
because
ether_addr_copy() needs 2 byte aligned source and destination buffers.

-michael
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help