From patchwork Thu May 7 14:34:30 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Colin King X-Patchwork-Id: 219674 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 29D21C38A24 for ; Thu, 7 May 2020 14:36:39 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 12B412073A for ; Thu, 7 May 2020 14:36:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728990AbgEGOgi (ORCPT ); Thu, 7 May 2020 10:36:38 -0400 Received: from youngberry.canonical.com ([91.189.89.112]:55690 "EHLO youngberry.canonical.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728381AbgEGOgg (ORCPT ); Thu, 7 May 2020 10:36:36 -0400 Received: from 1.general.cking.uk.vpn ([10.172.193.212] helo=localhost) by youngberry.canonical.com with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1jWhbb-0004ZE-4U; Thu, 07 May 2020 14:34:31 +0000 From: Colin King To: Andrew Lunn , Florian Fainelli , Heiner Kallweit , Russell King , "David S . Miller" , Oleksij Rempel , netdev@vger.kernel.org Cc: kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH][next] net: phy: fix less than zero comparison with unsigned variable val Date: Thu, 7 May 2020 15:34:30 +0100 Message-Id: <20200507143430.50507-1-colin.king@canonical.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Colin Ian King The unsigned variable val is being checked for an error by checking if it is less than zero. This can never occur because val is unsigned. Fix this by making val a plain int. Addresses-Coverity: ("Unsigned compared against zero") Fixes: bdbdac7649fa ("ethtool: provide UAPI for PHY master/slave configuration.") Signed-off-by: Colin Ian King --- drivers/net/phy/phy_device.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c index 83fc8e1b5793..c3a107cf578e 100644 --- a/drivers/net/phy/phy_device.c +++ b/drivers/net/phy/phy_device.c @@ -1948,7 +1948,7 @@ static int genphy_setup_master_slave(struct phy_device *phydev) static int genphy_read_master_slave(struct phy_device *phydev) { int cfg, state; - u16 val; + int val; if (!phydev->is_gigabit_capable) { phydev->master_slave_get = MASTER_SLAVE_CFG_UNSUPPORTED;