From patchwork Tue Jan 28 14:05:55 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Kroah-Hartman X-Patchwork-Id: 232646 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=DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, 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 63F3CC2D0DB for ; Tue, 28 Jan 2020 14:23:19 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 3B69F2468D for ; Tue, 28 Jan 2020 14:23:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1580221399; bh=2B2rA3l6uPgjItINxruWP2VXIZ5diO+y9uVKKp1FoeE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=s+VMLfphtBgC2yG3RrevQ7XZQxwHT9jNufEbtnQinscvV7ebDAX+9W5FbBdbEKK5n OvnGSIq5GzZ7viK/ou6SAxsbgeHY7hUji/P1ITR30z6k+UiDGF/7fgv5F8lSTglcjp gw4ttGt25Q5Gq2m1PVjv9urcf1OJ4kYepnxm7jpQ= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726024AbgA1OXR (ORCPT ); Tue, 28 Jan 2020 09:23:17 -0500 Received: from mail.kernel.org ([198.145.29.99]:49274 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731441AbgA1OXO (ORCPT ); Tue, 28 Jan 2020 09:23:14 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id DC59221739; Tue, 28 Jan 2020 14:23:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1580221393; bh=2B2rA3l6uPgjItINxruWP2VXIZ5diO+y9uVKKp1FoeE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Z34+qZwoteK4Or6SMNR3NkZi+4XAoZEoDmZPQIfonzFhvX6G/7Nlhjq+3CAfF6j/r GVwYQKJgvE0UifChskYJzHaTZz8HQ16t8Tzo64mvfn0ShsNLk0qv56vAQWQx6v761B F1pi5PVKgCyeL4c8o/dpOlAaaCqlUWFRjkWhTL+g= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dan Carpenter , "David S. Miller" , Sasha Levin Subject: [PATCH 4.9 206/271] of: mdio: Fix a signedness bug in of_phy_get_and_connect() Date: Tue, 28 Jan 2020 15:05:55 +0100 Message-Id: <20200128135907.887472260@linuxfoundation.org> X-Mailer: git-send-email 2.25.0 In-Reply-To: <20200128135852.449088278@linuxfoundation.org> References: <20200128135852.449088278@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Dan Carpenter [ Upstream commit d7eb651212fdbafa82d485d8e76095ac3b14c193 ] The "iface" variable is an enum and in this context GCC treats it as an unsigned int so the error handling is never triggered. Fixes: b78624125304 ("of_mdio: Abstract a general interface for phy connect") Signed-off-by: Dan Carpenter Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- drivers/of/of_mdio.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/of/of_mdio.c b/drivers/of/of_mdio.c index 262281bd68fa3..1e70851b15308 100644 --- a/drivers/of/of_mdio.c +++ b/drivers/of/of_mdio.c @@ -353,7 +353,7 @@ struct phy_device *of_phy_get_and_connect(struct net_device *dev, struct phy_device *phy; iface = of_get_phy_mode(np); - if (iface < 0) + if ((int)iface < 0) return NULL; phy_np = of_parse_phandle(np, "phy-handle", 0);