diff options
author | Jakub Kicinski <kuba@kernel.org> | 2020-10-08 15:44:50 -0700 |
---|---|---|
committer | Jakub Kicinski <kuba@kernel.org> | 2020-10-08 15:44:50 -0700 |
commit | 9d49aea13f1e35869158abe7e314e16dc8f50ff1 (patch) | |
tree | c878d774db35fdb9834621e2f354973dc09f2702 /drivers/net/usb/rtl8150.c | |
parent | 9faebeb2d80065926dfbc09cb73b1bb7779a89cd (diff) | |
parent | 3fdd47c3b40ac48e6e6e5904cf24d12e6e073a96 (diff) |
Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net
Small conflict around locking in rxrpc_process_event() -
channel_lock moved to bundle in next, while state lock
needs _bh() from net.
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Diffstat (limited to 'drivers/net/usb/rtl8150.c')
-rw-r--r-- | drivers/net/usb/rtl8150.c | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/drivers/net/usb/rtl8150.c b/drivers/net/usb/rtl8150.c index 733f120c852b..9d079dc2a535 100644 --- a/drivers/net/usb/rtl8150.c +++ b/drivers/net/usb/rtl8150.c @@ -274,12 +274,20 @@ static int write_mii_word(rtl8150_t * dev, u8 phy, __u8 indx, u16 reg) return 1; } -static inline void set_ethernet_addr(rtl8150_t * dev) +static void set_ethernet_addr(rtl8150_t *dev) { - u8 node_id[6]; + u8 node_id[ETH_ALEN]; + int ret; + + ret = get_registers(dev, IDR, sizeof(node_id), node_id); - get_registers(dev, IDR, sizeof(node_id), node_id); - memcpy(dev->netdev->dev_addr, node_id, sizeof(node_id)); + if (ret == sizeof(node_id)) { + ether_addr_copy(dev->netdev->dev_addr, node_id); + } else { + eth_hw_addr_random(dev->netdev); + netdev_notice(dev->netdev, "Assigned a random MAC address: %pM\n", + dev->netdev->dev_addr); + } } static int rtl8150_set_mac_address(struct net_device *netdev, void *p) |