Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp1567368pxb; Thu, 16 Sep 2021 10:04:06 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyqXU0beypC8hxtl1ma3QAg2B1yUU+nalKYXGV/ifNGRQdmb/peRw10mCvjsptTc7hfXeum X-Received: by 2002:a17:906:a382:: with SMTP id k2mr7500350ejz.454.1631811846164; Thu, 16 Sep 2021 10:04:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631811846; cv=none; d=google.com; s=arc-20160816; b=AGeEypC8dHchwPHx5/YV1qwPlHGwN0NjgbOXbac1SEFsjgDDKKIkSJqVMs7SIsgiGK RNTfGzEUhgG2x/DHSzMbRzdWHmHIkJww6cxWZ+5p1e5uz7pV8QgUVv+lxdQd7vQTif++ 2Fhi8smCao9MBlvP8up5vyCH7l5dHnUgxECNLGeBzA6/ZWvboJ2ExL69k1iz0zNP/z28 niUAJuRPhXZnLCJaebP9QHsQ4ImOI9Ugn7TU3H75fnBl6n19e9Ogw4pLyuQo6Rh6do5z 13ubP/IMDO2TONO/Sx2r4uIvUjaJDcwtzQQ83feG9UTOXIaK9U1bRVAjd0DA3XYIzwGv l1bg== 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=bttQex7p7TMAo0fwRqoYpI04NJBJ57+vkBopoOl7Jfo=; b=kVe5M8CgSGUQscxfxW6O3AGRuFDscWnhBpezcU+5W4JfTEHAeMS6EdbR9pIUBTWa+x qpgHFKEWxLGbgBUTW3XTp0htJ96Ss7zBZ1NCDbbl+svWwFWVVemSkt/NpjUxSMo6ztgx 4L/jNbkKwXxCzzIFnpdfMJEkS7k3bETIS37uOK0tnhWAiYhFHiisY4gff4UQ+EVeu2Rn RL76EZ/AAPn8Ql4IPOGiDCyzFr2YwyDWrnrdRbLbaCWqu5LMMAP/z/SEpWouAZ3mwmC2 jhgElgXJgaGGBi7O730DqAQl9mKwfliFpE+eAhMK7SRFH5xZWtEA9k5lnCI6y4JDTxt3 5tMg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ERP6nqW1; 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 i10si4899868ejd.745.2021.09.16.10.03.38; Thu, 16 Sep 2021 10:04:06 -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=ERP6nqW1; 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 S241873AbhIPQz5 (ORCPT + 99 others); Thu, 16 Sep 2021 12:55:57 -0400 Received: from mail.kernel.org ([198.145.29.99]:36668 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345703AbhIPQui (ORCPT ); Thu, 16 Sep 2021 12:50:38 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 90A68615E2; Thu, 16 Sep 2021 16:28:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1631809705; bh=A/QQumOH8O6k/Xn5qDY6TMC4AxTRp7rzpMcWLtKRmjY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ERP6nqW1Q/l+RDIp1Cq+dHXG+sDgVkHVNXYnAPusUR7Lb/x0mWDcvyFkLKmJLEbjo CWO13HDztzMzicq40ycP1i7Osb9FxRGrBGOIAMw6pl3MSjbHNEF6YrSOfaMbhRwAaR Pj/HhybMhDMGGM9Ac6sc4KvyRdct2NiQUBSoGbrs= 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.13 245/380] net: ethernet: stmmac: Do not use unreachable() in ipq806x_gmac_probe() Date: Thu, 16 Sep 2021 18:00:02 +0200 Message-Id: <20210916155812.412083197@linuxfoundation.org> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20210916155803.966362085@linuxfoundation.org> References: <20210916155803.966362085@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 28dd0ed85a82..f7dc8458cde8 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