Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp4167632pxj; Tue, 8 Jun 2021 08:01:27 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxmzQfPy1Av+6EMzStYQ9kzD1EkeaMns0/QNz4CvsMqTnPlqw78OTbjMFq1mz/5mw/5lVcI X-Received: by 2002:a17:907:770a:: with SMTP id kw10mr24018931ejc.213.1623164486820; Tue, 08 Jun 2021 08:01:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1623164486; cv=none; d=google.com; s=arc-20160816; b=vEMxBsHHYaIxw+1BQgKntNm0kwRIzdssR6osJSDk1lEa0SaHCgWEYyX+nAJDTjaQ5n eWv7AaFiW7kv17kuW7C0kf6G/1X0zNhw6ngfpVsKtHzTxlmS/S6+gJDlKm8SCFJOWFh5 +GSxTexyxE9DvArm3pCT/y0K2lBUhTtknys15BS9XVOBMv89aJnNQkoomAP6sWArsi6O PQ6rVDhOcRTtRcZTTJzWS/0tvc1nawG8T7NGwoe2z3+NdmW9zUXLvmMadwc4JMfOMzkH 7SqV4LPhqhzNJ1/+v2Gv2rtv8jjTwgh+B8KxcYnxMzbXtKfKZixLZ0xx12U2sPjRtQYI dI6A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=n3V8hBfayP0+Ixb7U8WnwrpLZRe9QajIy10Ex1vWyis=; b=LLZYzk+5RcgrY8DMkkEYQDDQP/GWVX9xRj+hxtYUiuwgu8rlRhOpKJfREOavbLgY0V iqWc7fbWZwqNbX2a1cAexwFxPwOPsIMEbNIzquxMQz0maBHjoa3MlYMNcDOnOfhl/qHi sEhW7gjlV0NzumN4uf/L/u8PqmqhDkovnOKf3ArDH97mhu/31IiZ1J5STVzYYiPoA65X pMeDfFe0Mcsg0T005Yvk7RbcTrK3v9Zb7Kude28pZ/nrvSuCtldzelJF4UgM/c3Jn8K8 0OJV6RPDe6cRMfW5gV+k40eLNpnruUNrmXb45Lt/v3DtgGpAt2+dN94DeuTwyAX1Pu92 Flhg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=canonical.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id bv2si15942748ejb.450.2021.06.08.08.01.02; Tue, 08 Jun 2021 08:01:26 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=canonical.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233730AbhFHPAV (ORCPT + 99 others); Tue, 8 Jun 2021 11:00:21 -0400 Received: from youngberry.canonical.com ([91.189.89.112]:37430 "EHLO youngberry.canonical.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233540AbhFHPAT (ORCPT ); Tue, 8 Jun 2021 11:00:19 -0400 Received: from 1.general.cking.uk.vpn ([10.172.193.212] helo=localhost) by youngberry.canonical.com with esmtpsa (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.93) (envelope-from ) id 1lqdBP-0003XW-MY; Tue, 08 Jun 2021 14:58:23 +0000 From: Colin King To: "David S . Miller" , Jakub Kicinski , Oleksij Rempel , linux-usb@vger.kernel.org, netdev@vger.kernel.org Cc: kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH][next] net: usb: asix: ax88772: Fix less than zero comparison of a u16 Date: Tue, 8 Jun 2021 15:58:23 +0100 Message-Id: <20210608145823.159467-1-colin.king@canonical.com> X-Mailer: git-send-email 2.31.1 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Colin Ian King The comparison of the u16 priv->phy_addr < 0 is always false because phy_addr is unsigned. Fix this by assigning the return from the call to function asix_read_phy_addr to int ret and using this for the less than zero error check comparison. Addresses-Coverity: ("Unsigned compared against 0") Fixes: e532a096be0e ("net: usb: asix: ax88772: add phylib support") Signed-off-by: Colin Ian King --- drivers/net/usb/asix_devices.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/net/usb/asix_devices.c b/drivers/net/usb/asix_devices.c index 57dafb3262d9..211c5a87eb15 100644 --- a/drivers/net/usb/asix_devices.c +++ b/drivers/net/usb/asix_devices.c @@ -704,9 +704,10 @@ static int ax88772_init_phy(struct usbnet *dev) struct asix_common_private *priv = dev->driver_priv; int ret; - priv->phy_addr = asix_read_phy_addr(dev, true); - if (priv->phy_addr < 0) + ret = asix_read_phy_addr(dev, true); + if (ret < 0) return priv->phy_addr; + priv->phy_addr = ret; snprintf(priv->phy_name, sizeof(priv->phy_name), PHY_ID_FMT, priv->mdio->id, priv->phy_addr); -- 2.31.1