Received: by 2002:a05:6520:4d:b0:139:a872:a4c9 with SMTP id i13csp2565474lkm; Mon, 20 Sep 2021 18:51:44 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzMkHxnzfHUVSxxmcx9WyBK2mcqqRmSANMwsiRJTTNkzQmeIKxI8N8urkTT7P1jcrOQqJYv X-Received: by 2002:a05:6e02:1b89:: with SMTP id h9mr19254817ili.297.1632188996082; Mon, 20 Sep 2021 18:49:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632188996; cv=none; d=google.com; s=arc-20160816; b=zG86GJil2p3htDi6z+l6kDNFqkl98+gmxj8UPdezyvLeGikRVbjzyHd/jcFnBlRXeq Y9QvbrsJ1H4268Nhbh3sc0/Mrf1plfwov/rDhobhxHxq2Q4+pSlnUgWm+UKCaA+N7sXA eZ/NHWfykuDBkhZckvrEmND2OOjn4xT/bMLgCgEnclMNqD+eGzkrRIV0TppZwOzCZmMp Oe9o7sSC4wSC/AqRpOBIC7190jNkt5rq+bsO3Eq/VqqYh7fMbyyVxaAqamuyUBwjF6Df lrKHcVX3dW+PbuvNW6OoQbtMAy3ATEhscXAvlMxlIy7Tuf3oHiFXkR5GV4JzFBqg1Qox r5sQ== 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=tghsTLgmbaHZ0PAq9TGBCb4gOztLCGyvUujPFSUHM1A=; b=GdQ8/QVGqOdX9FwWI+ptqIobc9K6uSIf4bM4TGfD3n6ybs6poES0WpywTZ/SUBaWZJ IS5wpuodAQVaiXj+RoXG8wXq2P9pQkMa8KrHvxZdVMjvMcNACLxDAyVR3oPBQxTrI01w T7dVjTMeZJ+7AXKsMHMzYSSxOxcKrbIaHGXcjWsmUIeaBiWGZe9/23/CcKWulb00tK8M 6WDChleL4NyXi+EHx0OVUrGhvLBot2/dgcoS8tBhofl6knSXjTfnB64Q0OIfI8xTM0QR TKfZ73R1m8NO41lMD8cDe2ScrFZTVnAX9s32vLwd0Tj3JoUV6EYib5bY53Q1xDCNzvYI 8xWw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=GP4xmrqG; 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 n27si1119733jac.76.2021.09.20.18.49.45; Mon, 20 Sep 2021 18:49:56 -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=GP4xmrqG; 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 S244275AbhITR73 (ORCPT + 99 others); Mon, 20 Sep 2021 13:59:29 -0400 Received: from mail.kernel.org ([198.145.29.99]:54992 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1349809AbhITRxa (ORCPT ); Mon, 20 Sep 2021 13:53:30 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id F2CFD619E1; Mon, 20 Sep 2021 17:13:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1632157992; bh=CcGd3tLppzua3RpBPmsOGIVB1hJU/S8evCoxGLnypmo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=GP4xmrqG07wI5IX71ZbP48AAU+t3tUmbS30u5+hygqASyAyIHkwk8+Ufv9HxUhtu9 xexdwc4bJwBPpdEhUonha/mVqpHgPRW99Boq//HuTFsx+ltdlVjxeMw/EmP/YEr/T1 e9Cz2+NdiNRfve8ir+2aQe6oleMSBdFzRMaEUSps= 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 4.19 213/293] net: ethernet: stmmac: Do not use unreachable() in ipq806x_gmac_probe() Date: Mon, 20 Sep 2021 18:42:55 +0200 Message-Id: <20210920163940.660531558@linuxfoundation.org> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20210920163933.258815435@linuxfoundation.org> References: <20210920163933.258815435@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 0f56f8e33691..03b11f191c26 100644 --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-ipq806x.c +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-ipq806x.c @@ -288,10 +288,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); @@ -308,10 +305,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); @@ -328,8 +322,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); @@ -360,6 +353,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