Jiri Slaby 221c28
From: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
Jiri Slaby 221c28
Date: Wed, 15 Mar 2023 14:41:17 +0100
Jiri Slaby 221c28
Subject: [PATCH] i825xx: sni_82596: use eth_hw_addr_set()
Jiri Slaby 221c28
References: bsc#1012628
Jiri Slaby 221c28
Patch-mainline: 6.2.8
Jiri Slaby 221c28
Git-commit: f38373345c65529639a01fba3675eb8cb4c579c3
Jiri Slaby 221c28
Jiri Slaby 221c28
[ Upstream commit f38373345c65529639a01fba3675eb8cb4c579c3 ]
Jiri Slaby 221c28
Jiri Slaby 221c28
netdev->dev_addr is now const, we can't write to it directly.
Jiri Slaby 221c28
Copy scrambled mac address octects into an array then eth_hw_addr_set().
Jiri Slaby 221c28
Jiri Slaby 221c28
Fixes: adeef3e32146 ("net: constify netdev->dev_addr")
Jiri Slaby 221c28
Signed-off-by: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
Jiri Slaby 221c28
Reviewed-by: Michal Kubiak <michal.kubiak@intel.com>
Jiri Slaby 221c28
Link: https://lore.kernel.org/r/20230315134117.79511-1-tsbogend@alpha.franken.de
Jiri Slaby 221c28
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Jiri Slaby 221c28
Signed-off-by: Sasha Levin <sashal@kernel.org>
Jiri Slaby 221c28
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Jiri Slaby 221c28
---
Jiri Slaby 221c28
 drivers/net/ethernet/i825xx/sni_82596.c | 14 ++++++++------
Jiri Slaby 221c28
 1 file changed, 8 insertions(+), 6 deletions(-)
Jiri Slaby 221c28
Jiri Slaby 221c28
diff --git a/drivers/net/ethernet/i825xx/sni_82596.c b/drivers/net/ethernet/i825xx/sni_82596.c
Jiri Slaby 221c28
index daec9ce0..54bb4d9a 100644
Jiri Slaby 221c28
--- a/drivers/net/ethernet/i825xx/sni_82596.c
Jiri Slaby 221c28
+++ b/drivers/net/ethernet/i825xx/sni_82596.c
Jiri Slaby 221c28
@@ -78,6 +78,7 @@ static int sni_82596_probe(struct platform_device *dev)
Jiri Slaby 221c28
 	void __iomem *mpu_addr;
Jiri Slaby 221c28
 	void __iomem *ca_addr;
Jiri Slaby 221c28
 	u8 __iomem *eth_addr;
Jiri Slaby 221c28
+	u8 mac[ETH_ALEN];
Jiri Slaby 221c28
 
Jiri Slaby 221c28
 	res = platform_get_resource(dev, IORESOURCE_MEM, 0);
Jiri Slaby 221c28
 	ca = platform_get_resource(dev, IORESOURCE_MEM, 1);
Jiri Slaby 221c28
@@ -109,12 +110,13 @@ static int sni_82596_probe(struct platform_device *dev)
Jiri Slaby 221c28
 		goto probe_failed;
Jiri Slaby 221c28
 
Jiri Slaby 221c28
 	/* someone seems to like messed up stuff */
Jiri Slaby 221c28
-	netdevice->dev_addr[0] = readb(eth_addr + 0x0b);
Jiri Slaby 221c28
-	netdevice->dev_addr[1] = readb(eth_addr + 0x0a);
Jiri Slaby 221c28
-	netdevice->dev_addr[2] = readb(eth_addr + 0x09);
Jiri Slaby 221c28
-	netdevice->dev_addr[3] = readb(eth_addr + 0x08);
Jiri Slaby 221c28
-	netdevice->dev_addr[4] = readb(eth_addr + 0x07);
Jiri Slaby 221c28
-	netdevice->dev_addr[5] = readb(eth_addr + 0x06);
Jiri Slaby 221c28
+	mac[0] = readb(eth_addr + 0x0b);
Jiri Slaby 221c28
+	mac[1] = readb(eth_addr + 0x0a);
Jiri Slaby 221c28
+	mac[2] = readb(eth_addr + 0x09);
Jiri Slaby 221c28
+	mac[3] = readb(eth_addr + 0x08);
Jiri Slaby 221c28
+	mac[4] = readb(eth_addr + 0x07);
Jiri Slaby 221c28
+	mac[5] = readb(eth_addr + 0x06);
Jiri Slaby 221c28
+	eth_hw_addr_set(netdevice, mac);
Jiri Slaby 221c28
 	iounmap(eth_addr);
Jiri Slaby 221c28
 
Jiri Slaby 221c28
 	if (netdevice->irq < 0) {
Jiri Slaby 221c28
-- 
Jiri Slaby 221c28
2.35.3
Jiri Slaby 221c28