diff options
Diffstat (limited to 'drivers/net/virtio_net.c')
-rw-r--r-- | drivers/net/virtio_net.c | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c index a6f1e19159d8..9c82a39497e5 100644 --- a/drivers/net/virtio_net.c +++ b/drivers/net/virtio_net.c | |||
@@ -575,8 +575,9 @@ static int virtnet_set_mac_address(struct net_device *dev, void *p) | |||
575 | if (ret) | 575 | if (ret) |
576 | return ret; | 576 | return ret; |
577 | 577 | ||
578 | vdev->config->set(vdev, offsetof(struct virtio_net_config, mac), | 578 | if (virtio_has_feature(vdev, VIRTIO_NET_F_MAC)) |
579 | dev->dev_addr, dev->addr_len); | 579 | vdev->config->set(vdev, offsetof(struct virtio_net_config, mac), |
580 | dev->dev_addr, dev->addr_len); | ||
580 | 581 | ||
581 | return 0; | 582 | return 0; |
582 | } | 583 | } |
@@ -876,11 +877,8 @@ static int virtnet_probe(struct virtio_device *vdev) | |||
876 | vdev->config->get(vdev, | 877 | vdev->config->get(vdev, |
877 | offsetof(struct virtio_net_config, mac), | 878 | offsetof(struct virtio_net_config, mac), |
878 | dev->dev_addr, dev->addr_len); | 879 | dev->dev_addr, dev->addr_len); |
879 | } else { | 880 | } else |
880 | random_ether_addr(dev->dev_addr); | 881 | random_ether_addr(dev->dev_addr); |
881 | vdev->config->set(vdev, offsetof(struct virtio_net_config, mac), | ||
882 | dev->dev_addr, dev->addr_len); | ||
883 | } | ||
884 | 882 | ||
885 | /* Set up our device-specific information */ | 883 | /* Set up our device-specific information */ |
886 | vi = netdev_priv(dev); | 884 | vi = netdev_priv(dev); |