Skip to content

Commit 23ea630

Browse files
jcmvbkbckuba-moo
authored andcommitted
net: natsemi: fix hw address initialization for jazz and xtensa
Use eth_hw_addr_set function instead of writing the address directly to net_device::dev_addr. Fixes: adeef3e ("net: constify netdev->dev_addr") Signed-off-by: Max Filippov <[email protected]> Acked-by: Randy Dunlap <[email protected]> # build-tested Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
1 parent 5cfe53c commit 23ea630

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

drivers/net/ethernet/natsemi/jazzsonic.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,7 @@ static int sonic_probe1(struct net_device *dev)
114114
struct sonic_local *lp = netdev_priv(dev);
115115
int err = -ENODEV;
116116
int i;
117+
unsigned char addr[ETH_ALEN];
117118

118119
if (!request_mem_region(dev->base_addr, SONIC_MEM_SIZE, jazz_sonic_string))
119120
return -EBUSY;
@@ -143,9 +144,10 @@ static int sonic_probe1(struct net_device *dev)
143144
SONIC_WRITE(SONIC_CEP,0);
144145
for (i=0; i<3; i++) {
145146
val = SONIC_READ(SONIC_CAP0-i);
146-
dev->dev_addr[i*2] = val;
147-
dev->dev_addr[i*2+1] = val >> 8;
147+
addr[i*2] = val;
148+
addr[i*2+1] = val >> 8;
148149
}
150+
eth_hw_addr_set(dev, addr);
149151

150152
lp->dma_bitmode = SONIC_BITMODE32;
151153

drivers/net/ethernet/natsemi/xtsonic.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,7 @@ static int __init sonic_probe1(struct net_device *dev)
127127
unsigned int base_addr = dev->base_addr;
128128
int i;
129129
int err = 0;
130+
unsigned char addr[ETH_ALEN];
130131

131132
if (!request_mem_region(base_addr, 0x100, xtsonic_string))
132133
return -EBUSY;
@@ -163,9 +164,10 @@ static int __init sonic_probe1(struct net_device *dev)
163164

164165
for (i=0; i<3; i++) {
165166
unsigned int val = SONIC_READ(SONIC_CAP0-i);
166-
dev->dev_addr[i*2] = val;
167-
dev->dev_addr[i*2+1] = val >> 8;
167+
addr[i*2] = val;
168+
addr[i*2+1] = val >> 8;
168169
}
170+
eth_hw_addr_set(dev, addr);
169171

170172
lp->dma_bitmode = SONIC_BITMODE32;
171173

0 commit comments

Comments
 (0)