aqc111_set_mac_addr() returns the result of aqc111_write_cmd() on
success. That function wraps usb_control_msg(), which returns the
number of bytes transferred (6 for ETH_ALEN) rather than zero.
Callers such as netif_set_mac_address() and bonding treat any
non-zero return value as failure when setting the MAC address.
Return 0 on success and propagate negative error codes on failure.
Link: https://lore.kernel.org/netdev/20260703073936.462231-1-hanson.wang@ugreen.com (local)
Signed-off-by: Hanson Wang <redacted>
---
drivers/net/usb/aqc111.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/drivers/net/usb/aqc111.c b/drivers/net/usb/aqc111.c
index 9201ee10a..827aab540 100644
--- a/drivers/net/usb/aqc111.c
+++ b/drivers/net/usb/aqc111.c
@@ -476,8 +476,12 @@ static int aqc111_set_mac_addr(struct net_device *net, void *p)
return ret;
/* Set the MAC address */
- return aqc111_write_cmd(dev, AQ_ACCESS_MAC, SFR_NODE_ID, ETH_ALEN,
- ETH_ALEN, net->dev_addr);
+ ret = aqc111_write_cmd(dev, AQ_ACCESS_MAC, SFR_NODE_ID,
+ ETH_ALEN, ETH_ALEN, net->dev_addr);
+ if (ret < 0)
+ return ret;
+
+ return 0;
}
static int aqc111_vlan_rx_kill_vid(struct net_device *net,
--
2.34.1