Re: [PATCH net-next] net: usb: ax88172a: improve MAC address read error handling
From: Andrew Lunn
Date: Mon Sep 28 2026 - 13:12:35 EST
On Mon, Sep 28, 2026 at 12:40:11AM -0400, Xinsheng Zhu wrote:
> When retrieving the MAC address, ax88172a_bind() checks the return
> value of asix_read_cmd() against ETH_ALEN to detect short reads.
> Commit c28d9a285668 ("ax88172a: fix ax88172a_unbind() failures") added
> an -EIO assignment to ensure that this failure path returns a negative
> error code, even when asix_read_cmd() returns a non-negative short-read
> length.
>
> Short-read handling was subsequently added to asix_read_cmd() by commit
> 920a9fa27e78 ("net: asix: add proper error handling of usb read errors").
> The helper now converts short reads to -ENODATA while preserving
> negative errors from the underlying USB read operation.
>
> The MAC address short-read check in ax88172a_bind() is therefore
> redundant now, and overwriting the return value with -EIO is no longer
> necessary to ensure that the failure path returns a negative error code.
>
> Check only for negative return values and remove the -EIO assignment
> to preserve the error returned by asix_read_cmd() through the existing
> cleanup path.
>
> Signed-off-by: Xinsheng Zhu <xinsheng.zhu.ny@xxxxxxxxx>
Reviewed-by: Andrew Lunn <andrew@xxxxxxx>
Andrew