Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp4952629iog; Wed, 22 Jun 2022 08:57:38 -0700 (PDT) X-Google-Smtp-Source: AGRyM1swD5WqTD2b52WjWmsm89oThRINenQZ7gbj2vMYU1f18FGFRozv002xIlrIn+OWLhc8uqRJ X-Received: by 2002:a05:6402:388c:b0:435:548c:177e with SMTP id fd12-20020a056402388c00b00435548c177emr4910870edb.231.1655913458459; Wed, 22 Jun 2022 08:57:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1655913458; cv=none; d=google.com; s=arc-20160816; b=NiVkPJUW90uywNJMKNAZXVybsx/yYijxsGHreWq4goEuZApXcA2vIkpt2mMuKDhzLl PlNU5yzEcSfoNaQb0ZvnbriDpbfHq3+D5j3QnYZzJCKJbz+oahasWSMvCtV5qwtTeobF kZ2oc10MU6bbSzuzOxRI1KMvVBzvLESpZ1MjzsoGQiQenhTMhBW+8To9ynh+f8r/jcxJ 3sUuVsjBLaUdilzPCfbWN5vghEXzsUk1JEUagv0Eqa4qxyuDZ2ixIh3I9+K9f/cvm9I2 9ox2zk7Sesh6IM6wD/usk4Pz3trraTyahzs0eSp/O07Pd8MbvNi51W4ytdDAzdovT/8f Vakg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from; bh=2SyOxloE12TTggoLljc8n+yyuMjdE/YqCPIeEJeeMmA=; b=p6AJCavNQJTyFY6A/jOXEQWJZhSvPcyK4zq3K9Ta5WNma5juGq1szj8odUcRSyxdt+ 8tF0PSBPCGC4YrJVD2kM09S3xoEVqsxl8/4jXGx4VIQncy7gEGLv/BZZTlznCLQJ0uNS Na6w5BOFAkIxfFa3YTi+/1ZpvMSFfom68gt1u8z8Yu6njzFi7dOuYMKXZ5oE+JXVcAzR IdfjpZ/kwMfKi418sNeH7Fc7q3d0/VADyI4I0QC5pqdlbASDbj4/2ium5Emrm3uyx9MB I9djaxY321/ccTbzd+F4RzeuMCZTbQ8izvxIoJ7QYHyWXqCXqoHrOk++n/P03NI01hW4 +jFA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id n9-20020a17090673c900b006fa88dad76dsi16331572ejl.193.2022.06.22.08.57.12; Wed, 22 Jun 2022 08:57:38 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1359835AbiFVPzu (ORCPT + 99 others); Wed, 22 Jun 2022 11:55:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52870 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1359681AbiFVPxG (ORCPT ); Wed, 22 Jun 2022 11:53:06 -0400 Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CEF5B23F; Wed, 22 Jun 2022 08:52:51 -0700 (PDT) Received: from dggpemm500023.china.huawei.com (unknown [172.30.72.54]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4LSnr363QWzSh6d; Wed, 22 Jun 2022 23:49:23 +0800 (CST) Received: from dggpemm500013.china.huawei.com (7.185.36.172) by dggpemm500023.china.huawei.com (7.185.36.83) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Wed, 22 Jun 2022 23:52:48 +0800 Received: from ubuntu1804.huawei.com (10.67.175.36) by dggpemm500013.china.huawei.com (7.185.36.172) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Wed, 22 Jun 2022 23:52:47 +0800 From: Chen Zhongjin To: , , , , , CC: , , , , , , , , , , , , , Subject: [PATCH v5 32/33] arm64: irq-gic: Replace unreachable() with -EINVAL Date: Wed, 22 Jun 2022 23:49:19 +0800 Message-ID: <20220622154920.95075-33-chenzhongjin@huawei.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20220622154920.95075-1-chenzhongjin@huawei.com> References: <20220622154920.95075-1-chenzhongjin@huawei.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.67.175.36] X-ClientProxiedBy: dggems701-chm.china.huawei.com (10.3.19.178) To dggpemm500013.china.huawei.com (7.185.36.172) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Using unreachable() at default of switch generates an extra branch at end of the function, and compiler won't generate a ret to close this branch because it knows it's unreachable. If there's no instruction in this branch, compiler will generate a NOP, And it will confuse objtool to warn this NOP as a fall through branch. In fact these branches are actually unreachable, so we can replace unreachable() with returning a -EINVAL value. Signed-off-by: Chen Zhongjin --- arch/arm64/kvm/hyp/vgic-v3-sr.c | 7 +++---- drivers/irqchip/irq-gic-v3.c | 2 +- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/arch/arm64/kvm/hyp/vgic-v3-sr.c b/arch/arm64/kvm/hyp/vgic-v3-sr.c index 4fb419f7b8b6..f3cee92c3038 100644 --- a/arch/arm64/kvm/hyp/vgic-v3-sr.c +++ b/arch/arm64/kvm/hyp/vgic-v3-sr.c @@ -6,7 +6,6 @@ #include -#include #include #include @@ -55,7 +54,7 @@ static u64 __gic_v3_get_lr(unsigned int lr) return read_gicreg(ICH_LR15_EL2); } - unreachable(); + return -EINVAL; } static void __gic_v3_set_lr(u64 val, int lr) @@ -166,7 +165,7 @@ static u32 __vgic_v3_read_ap0rn(int n) val = read_gicreg(ICH_AP0R3_EL2); break; default: - unreachable(); + val = -EINVAL; } return val; @@ -190,7 +189,7 @@ static u32 __vgic_v3_read_ap1rn(int n) val = read_gicreg(ICH_AP1R3_EL2); break; default: - unreachable(); + val = -EINVAL; } return val; diff --git a/drivers/irqchip/irq-gic-v3.c b/drivers/irqchip/irq-gic-v3.c index b252d5534547..2ef98e32d257 100644 --- a/drivers/irqchip/irq-gic-v3.c +++ b/drivers/irqchip/irq-gic-v3.c @@ -475,7 +475,7 @@ static u32 __gic_get_ppi_index(irq_hw_number_t hwirq) case EPPI_RANGE: return hwirq - EPPI_BASE_INTID + 16; default: - unreachable(); + return -EINVAL; } } -- 2.17.1