ethernet: netsec: use eth_hw_addr_set()
authorJakub Kicinski <kuba@kernel.org>
Tue, 19 Oct 2021 15:00:06 +0000 (08:00 -0700)
committerDavid S. Miller <davem@davemloft.net>
Wed, 20 Oct 2021 10:41:01 +0000 (11:41 +0100)
Commit 406f42fa0d3c ("net-next: When a bond have a massive amount
of VLANs...") introduced a rbtree for faster Ethernet address look
up. To maintain netdev->dev_addr in this tree we need to make all
the writes to it got through appropriate helpers.

Read the address into an array on the stack, then call
eth_hw_addr_set().

Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Acked-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/socionext/netsec.c

index baa9f5d..de7d8bf 100644 (file)
@@ -2037,13 +2037,15 @@ static int netsec_probe(struct platform_device *pdev)
        if (ret && priv->eeprom_base) {
                void __iomem *macp = priv->eeprom_base +
                                        NETSEC_EEPROM_MAC_ADDRESS;
-
-               ndev->dev_addr[0] = readb(macp + 3);
-               ndev->dev_addr[1] = readb(macp + 2);
-               ndev->dev_addr[2] = readb(macp + 1);
-               ndev->dev_addr[3] = readb(macp + 0);
-               ndev->dev_addr[4] = readb(macp + 7);
-               ndev->dev_addr[5] = readb(macp + 6);
+               u8 addr[ETH_ALEN];
+
+               addr[0] = readb(macp + 3);
+               addr[1] = readb(macp + 2);
+               addr[2] = readb(macp + 1);
+               addr[3] = readb(macp + 0);
+               addr[4] = readb(macp + 7);
+               addr[5] = readb(macp + 6);
+               eth_hw_addr_set(ndev, addr);
        }
 
        if (!is_valid_ether_addr(ndev->dev_addr)) {