On 1/30/26 1:29 AM, Jonas Karlman wrote:
The ASIX 88179 driver asix_read/write_cmd() return a positive error
value instead of a typical negative error value. This return value is
checked in the asix_read/write_mac() to control a debug() print and can
also propagate to probe() and write_hwaddr() ops.

Change to use a proper negative ECOMM return value when read/write a
command. Also update to use the ETH_ALEN const instead of 6 for
consistent use in asix_read/write_mac().

Signed-off-by: Jonas Karlman <[email protected]>
---
  drivers/usb/eth/asix88179.c | 15 ++++++++-------
  1 file changed, 8 insertions(+), 7 deletions(-)

diff --git a/drivers/usb/eth/asix88179.c b/drivers/usb/eth/asix88179.c
index 69d3073b669a..8915ef1fdc36 100644
--- a/drivers/usb/eth/asix88179.c
+++ b/drivers/usb/eth/asix88179.c
@@ -235,7 +235,7 @@ static int asix_write_cmd(struct ueth_data *dev, u8 cmd, 
u16 value, u16 index,
                size,
                USB_CTRL_SET_TIMEOUT);
- return len == size ? 0 : ECOMM;
+       return len == size ? 0 : -ECOMM;
  }
static int asix_read_cmd(struct ueth_data *dev, u8 cmd, u16 value, u16 index,
@@ -260,15 +260,16 @@ static int asix_read_cmd(struct ueth_data *dev, u8 cmd, 
u16 value, u16 index,
memcpy(data, buf, size); - return len == size ? 0 : ECOMM;
+       return len == size ? 0 : -ECOMM;
  }
static int asix_read_mac(struct ueth_data *dev, uint8_t *enetaddr)
  {
        int ret;
- ret = asix_read_cmd(dev, AX_ACCESS_MAC, AX_NODE_ID, 6, 6, enetaddr);
-       if (ret < 0)
+       ret = asix_read_cmd(dev, AX_ACCESS_MAC, AX_NODE_ID,
+                           ETH_ALEN, ETH_ALEN, enetaddr);
+       if (ret)
                debug("Failed to read MAC address: %02x\n", ret);

This print likely needs to be fixed too, it prints unsigned hex while the value is now signed int.

return ret;
@@ -278,9 +279,9 @@ static int asix_write_mac(struct ueth_data *dev, uint8_t 
*enetaddr)
  {
        int ret;
- ret = asix_write_cmd(dev, AX_ACCESS_MAC, AX_NODE_ID, ETH_ALEN,
-                                ETH_ALEN, enetaddr);
-       if (ret < 0)
+       ret = asix_write_cmd(dev, AX_ACCESS_MAC, AX_NODE_ID,
+                            ETH_ALEN, ETH_ALEN, enetaddr);
+       if (ret)
                debug("Failed to set MAC address: %02x\n", ret);
DTTO

Reply via email to