Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp1701340pxb; Thu, 16 Sep 2021 13:21:58 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzDOQhXtbvEFm79zmu2WdUAz24mtXweoIH/0Ehv3c4qwozo4kHTC/vSC6JKFJZA758B5GBC X-Received: by 2002:a17:906:308d:: with SMTP id 13mr8147196ejv.570.1631823717834; Thu, 16 Sep 2021 13:21:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631823717; cv=none; d=google.com; s=arc-20160816; b=wUfC8AiwCmHmPpnzLFrvAibeGw67orPYOMCjyRHNeqZUxPoNySsPkrRyJXXQiq4XYs NshcVv/l/xDzmYJpt89TqFs/5cIeIz36IVhAOGeqSBX4ULK1+vAqQIaq3fvSWzjO6yLK wioca9WRFOigJ620pXnjAT5Ooo2Iu6Kb9Z/VMRWC7UO6kX9VBxhQ7i2+749IB0X3Pxsd qIJo/QOrVJX+Kxa9zmMraaXChEjgTbEjlNpeDu3gBgBnSqi38xzzqYgGjbIzMS3hmNZ0 htwxqCAyeA9h4dHi2hnWit8KyP+IUO5V7cHuQi0IyO/3v+/yPJ9ZwiLFBPHvSxzyAD7l mr1w== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=sXttDLYExOVod4lWL0jONiG0qnbjs2udVDB0wYX+Dc8=; b=TQmM4aI4lBlmGlDqwxUril4JwFYS9tEXD7VqqskCdkKY3HV3Wsx4vTaLWdeEIfO06B YpxKX+3/zghdFxOt8aSBs7vUFPI6Qan0MQYGEfAao2j0msW0xl/GP4yK9pN89Y9Pm8Bu Z4A0LAlzOdlcd+kz2GNt1VcZfyL5KiL+2PUL7FCir6fRANaWfwKzhG6oOgRvrzhDOFJk T4ycTilyR9IJVhjL475+2ESkKZQBtQ1lZXQN/NDLgbyJtFLGjM1vnCx34Sx1x2oNIinu h5khrPvWveYnol6Jl0peKxt082p2gmNBm2RpjwZ5AeR50X6n3Hjvl3k+5IZROg756P0u 2liQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=FCcECgFR; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id hq33si4518494ejc.437.2021.09.16.13.21.33; Thu, 16 Sep 2021 13:21:57 -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; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=FCcECgFR; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235327AbhIPQZG (ORCPT + 99 others); Thu, 16 Sep 2021 12:25:06 -0400 Received: from mail.kernel.org ([198.145.29.99]:54626 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240749AbhIPQRG (ORCPT ); Thu, 16 Sep 2021 12:17:06 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 85E3061288; Thu, 16 Sep 2021 16:12:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1631808722; bh=zTMNA5NBdOawUk6Fq2WAD72GWPifnUA5KvOd9+Mmb4Q=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=FCcECgFRsXiT2JX52M224qw7777jzq2k0X81f2Ptvpj13SXulSOmIDcJr+iB4VwCN Cf9l0nIjiMorq4NVx7AlBAzV0991knkx5FTHoPx/LgNh3pinal9H/qvOdUQ7iN2Ic0 n0+78ruuZD/A3au3WUVaweJ8IKFF3AiYFSBSVcGY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Sami Tolvanen , Nathan Chancellor , "David S. Miller" , Sasha Levin Subject: [PATCH 5.10 197/306] net: ethernet: stmmac: Do not use unreachable() in ipq806x_gmac_probe() Date: Thu, 16 Sep 2021 17:59:02 +0200 Message-Id: <20210916155800.778782404@linuxfoundation.org> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20210916155753.903069397@linuxfoundation.org> References: <20210916155753.903069397@linuxfoundation.org> User-Agent: quilt/0.66 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: Nathan Chancellor [ Upstream commit 4367355dd90942a71641c98c40c74589c9bddf90 ] When compiling with clang in certain configurations, an objtool warning appears: drivers/net/ethernet/stmicro/stmmac/dwmac-ipq806x.o: warning: objtool: ipq806x_gmac_probe() falls through to next function phy_modes() This happens because the unreachable annotation in the third switch statement is not eliminated. The compiler should know that the first default case would prevent the second and third from being reached as the comment notes but sanitizer options can make it harder for the compiler to reason this out. Help the compiler out by eliminating the unreachable() annotation and unifying the default case error handling so that there is no objtool warning, the meaning of the code stays the same, and there is less duplication. Reported-by: Sami Tolvanen Tested-by: Sami Tolvanen Signed-off-by: Nathan Chancellor Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- .../ethernet/stmicro/stmmac/dwmac-ipq806x.c | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-ipq806x.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-ipq806x.c index 749585fe6fc9..90f69f43770a 100644 --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-ipq806x.c +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-ipq806x.c @@ -289,10 +289,7 @@ static int ipq806x_gmac_probe(struct platform_device *pdev) val &= ~NSS_COMMON_GMAC_CTL_PHY_IFACE_SEL; break; default: - dev_err(&pdev->dev, "Unsupported PHY mode: \"%s\"\n", - phy_modes(gmac->phy_mode)); - err = -EINVAL; - goto err_remove_config_dt; + goto err_unsupported_phy; } regmap_write(gmac->nss_common, NSS_COMMON_GMAC_CTL(gmac->id), val); @@ -309,10 +306,7 @@ static int ipq806x_gmac_probe(struct platform_device *pdev) NSS_COMMON_CLK_SRC_CTRL_OFFSET(gmac->id); break; default: - dev_err(&pdev->dev, "Unsupported PHY mode: \"%s\"\n", - phy_modes(gmac->phy_mode)); - err = -EINVAL; - goto err_remove_config_dt; + goto err_unsupported_phy; } regmap_write(gmac->nss_common, NSS_COMMON_CLK_SRC_CTRL, val); @@ -329,8 +323,7 @@ static int ipq806x_gmac_probe(struct platform_device *pdev) NSS_COMMON_CLK_GATE_GMII_TX_EN(gmac->id); break; default: - /* We don't get here; the switch above will have errored out */ - unreachable(); + goto err_unsupported_phy; } regmap_write(gmac->nss_common, NSS_COMMON_CLK_GATE, val); @@ -361,6 +354,11 @@ static int ipq806x_gmac_probe(struct platform_device *pdev) return 0; +err_unsupported_phy: + dev_err(&pdev->dev, "Unsupported PHY mode: \"%s\"\n", + phy_modes(gmac->phy_mode)); + err = -EINVAL; + err_remove_config_dt: stmmac_remove_config_dt(pdev, plat_dat); -- 2.30.2