summaryrefslogtreecommitdiffstats
path: root/drivers/net/ethernet/cirrus/mac89x0.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/ethernet/cirrus/mac89x0.c')
-rw-r--r--drivers/net/ethernet/cirrus/mac89x0.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/drivers/net/ethernet/cirrus/mac89x0.c b/drivers/net/ethernet/cirrus/mac89x0.c
index 83781f316d1f..932fdccc339a 100644
--- a/drivers/net/ethernet/cirrus/mac89x0.c
+++ b/drivers/net/ethernet/cirrus/mac89x0.c
@@ -591,11 +591,15 @@ static void set_multicast_list(struct net_device *dev)
static int set_mac_address(struct net_device *dev, void *addr)
{
+ struct sockaddr *saddr = addr;
int i;
- printk("%s: Setting MAC address to ", dev->name);
- for (i = 0; i < 6; i++)
- printk(" %2.2x", dev->dev_addr[i] = ((unsigned char *)addr)[i]);
- printk(".\n");
+
+ if (!is_valid_ether_addr(saddr->sa_data))
+ return -EADDRNOTAVAIL;
+
+ memcpy(dev->dev_addr, saddr->sa_data, ETH_ALEN);
+ printk("%s: Setting MAC address to %pM\n", dev->name, dev->dev_addr);
+
/* set the Ethernet address */
for (i=0; i < ETH_ALEN/2; i++)
writereg(dev, PP_IA+i*2, dev->dev_addr[i*2] | (dev->dev_addr[i*2+1] << 8));
OpenPOWER on IntegriCloud