From patchwork Fri Jan 24 09:32:32 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 232884 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=unavailable 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 06857C2D0DB for ; Fri, 24 Jan 2020 11:34:13 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id C7D11214AF for ; Fri, 24 Jan 2020 11:34:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1579865652; bh=hCci7xL188rP8q58jiWbyf8ua8a7lzyy8rDNwkk9cXQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=ZTQm4C1rHElb78sG1ltdS0pvYt4iP3Ukwqg1xesXPqsPEE2nrrahQ9r/hbaqU0MqB PLgB42/Z0e37Hqvjj/yWjiwCpvn6jsERmodakgL/8YplP5fXQUj8PLky4yoWs60gAc 1ocAm6fezsiMxdfHNZee1xTXQtn8KibGiMXDhtFY= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2404453AbgAXLeH (ORCPT ); Fri, 24 Jan 2020 06:34:07 -0500 Received: from mail.kernel.org ([198.145.29.99]:53922 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2404680AbgAXLeF (ORCPT ); Fri, 24 Jan 2020 06:34:05 -0500 Received: from localhost (ip-213-127-102-57.ip.prioritytelecom.net [213.127.102.57]) (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 CBFB9206D4; Fri, 24 Jan 2020 11:34:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1579865645; bh=hCci7xL188rP8q58jiWbyf8ua8a7lzyy8rDNwkk9cXQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hkUw9YhfronqWyx/yeChn9P54Pt8l4k5NaU+tNXdC0DcPqA3M5sPmtNNQJSQv4E1y SIce2g44p/d2cEgD5LFM9RRR1hCTY8psAjNC8Dqw9p/oJqFA37XE75YmWrKdODnA8T Zbq9hAgka+CSVusJHJ99pS9SAXgRfqyd0ywcKYBE= 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.19 582/639] of: mdio: Fix a signedness bug in of_phy_get_and_connect() Date: Fri, 24 Jan 2020 10:32:32 +0100 Message-Id: <20200124093202.379677585@linuxfoundation.org> X-Mailer: git-send-email 2.25.0 In-Reply-To: <20200124093047.008739095@linuxfoundation.org> References: <20200124093047.008739095@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 5ad1342f56825..7d2bc22680d90 100644 --- a/drivers/of/of_mdio.c +++ b/drivers/of/of_mdio.c @@ -370,7 +370,7 @@ struct phy_device *of_phy_get_and_connect(struct net_device *dev, int ret; iface = of_get_phy_mode(np); - if (iface < 0) + if ((int)iface < 0) return NULL; if (of_phy_is_fixed_link(np)) { ret = of_phy_register_fixed_link(np);