[PATCH v2 1/1] r8152: sync sa_family with the media type of network device

From: crag0715
Date: Sun Apr 21 2019 - 22:24:38 EST


From: "Crag.Wang" <crag.wang@xxxxxxxx>

Without this patch the socket address family sporadically gets wrong
value ends up the dev_set_mac_address() fails to set the desired MAC
address.

Signed-off-by: Crag.Wang <crag.wang@xxxxxxxx>
---
drivers/net/usb/r8152.c | 2 ++
1 file changed, 2 insertions(+)

diff --git a/drivers/net/usb/r8152.c b/drivers/net/usb/r8152.c
index 4c63b40d5e00..41fb39ce69c9 100644
--- a/drivers/net/usb/r8152.c
+++ b/drivers/net/usb/r8152.c
@@ -1225,6 +1225,8 @@ static int determine_ethernet_addr(struct r8152 *tp, struct sockaddr *sa)
struct net_device *dev = tp->netdev;
int ret;

+ sa->sa_family = dev->type;
+
if (tp->version == RTL_VER_01) {
ret = pla_ocp_read(tp, PLA_IDR, 8, sa->sa_data);
} else {
--
2.20.1