usb_control_msg doesn't (always) return 0 on success. Adjust the error checks to explicitly check for negative return values instead. Signed-off-by: Ahmad Fatoum <a.fatoum@xxxxxxxxxxxxxx> --- Should probably be tested before applying. Sascha, can you easily do this? --- drivers/net/usb/asix.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/drivers/net/usb/asix.c b/drivers/net/usb/asix.c index fc7063095b6c..1140be9d1601 100644 --- a/drivers/net/usb/asix.c +++ b/drivers/net/usb/asix.c @@ -255,15 +255,15 @@ static int asix_mdio_read(struct mii_bus *bus, int phy_id, int loc) int ret; ret = asix_set_sw_mii(dev); - if (ret) + if (ret < 0) return ret; ret = asix_read_cmd(dev, AX_CMD_READ_MII_REG, phy_id, (__u16)loc, 2, &res); - if (ret) + if (ret < 0) return ret; ret = asix_set_hw_mii(dev); - if (ret) + if (ret < 0) return ret; dev_dbg(&dev->edev.dev, "asix_mdio_read() phy_id=0x%02x, loc=0x%02x, returns=0x%04x\n", @@ -282,14 +282,18 @@ static int asix_mdio_write(struct mii_bus *bus, int phy_id, int loc, u16 val) phy_id, loc, val); ret = asix_set_sw_mii(dev); - if (ret) + if (ret < 0) return ret; ret = asix_write_cmd(dev, AX_CMD_WRITE_MII_REG, phy_id, (__u16)loc, 2, &res); - if (ret) + if (ret < 0) return ret; - return asix_set_hw_mii(dev); + ret = asix_set_hw_mii(dev); + if (ret < 0) + return ret; + + return 0; } static inline int asix_get_phy_addr(struct usbnet *dev) -- 2.28.0 _______________________________________________ barebox mailing list barebox@xxxxxxxxxxxxxxxxxxx http://lists.infradead.org/mailman/listinfo/barebox