Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp5397558iog; Wed, 22 Jun 2022 19:22:56 -0700 (PDT) X-Google-Smtp-Source: AGRyM1vc+1+ob1vBNBi4vQmkz//dT4dTN0aTVtu66paqNdEK+suf/aGFXF+vRPcFstb/NdezG70A X-Received: by 2002:a17:90a:1a13:b0:1ec:8d23:f535 with SMTP id 19-20020a17090a1a1300b001ec8d23f535mr1480207pjk.131.1655950976348; Wed, 22 Jun 2022 19:22:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1655950976; cv=none; d=google.com; s=arc-20160816; b=DBRZ1FPOj9BpLbqU58GS2xs+PhWRA+eEXO6TPSgNEoj2z+D2zU6RvrVcFRokQApW/r l0Gc5jUJVUrfcRNoM9fbWb0513kiqX3fM8eImp+FRk8IruTfdiM7/3ldxdVROoXEdL+G 2Q/64I8BDnUsZpVs48R04JU9m+bufI/4NgmYvbVlNkxqtynRL9+RYvaraMH04uaxY2VL 74Qsz3Rs6IBucEzyqBXD2CcOT8mYcOzepA5RcyEzKM/vIaODO7czMPHjBmH7rL57NByg j0k/lZsnOfUq84YlQLCpVd0Uc6cHARF/b3yj17CSWWEvOIjzSMhS+t89ykwiUc8ivMjT WZFQ== 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=Q9HvTm7QkBI+Y9cQRQNeBhWcyxfd4k894OUIkrrwJ2hVKR3IXfimM7/byogSst/ALJ chlUhQQc0di03mUPhbl8BTXHunYmneNOQO8DeZQ86L5cWoVZfGXNva0ZyTA/f1e5XMCn EyHP80fPOToUCNitZxalHy/TBP8uFxBMwLalEWWwYzmGzFD1CMG9aqxuW0qygCFArTno MoijKma2hqJFOdv5ywWf8atZ0SD/FK+i/O7aFYFcJv2Ly3ut7cTseWL8YDCqjjQv4sFE zFClrY/ygytCMhV0u0DvHLd7LE/Yv7SU8Zsttfe2iBsuO+wFo8nO8P3cNlNXlP47B2tg V+mQ== 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 s38-20020a056a0017a600b0052533edba4asi9642272pfg.291.2022.06.22.19.22.42; Wed, 22 Jun 2022 19:22:56 -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 S1377848AbiFWByT (ORCPT + 99 others); Wed, 22 Jun 2022 21:54:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37248 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1377637AbiFWBwb (ORCPT ); Wed, 22 Jun 2022 21:52:31 -0400 Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BAD4843EC5; Wed, 22 Jun 2022 18:51:54 -0700 (PDT) Received: from dggpemm500020.china.huawei.com (unknown [172.30.72.54]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4LT37J1xxkzShCC; Thu, 23 Jun 2022 09:48:28 +0800 (CST) Received: from dggpemm500013.china.huawei.com (7.185.36.172) by dggpemm500020.china.huawei.com (7.185.36.49) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Thu, 23 Jun 2022 09:51:53 +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; Thu, 23 Jun 2022 09:51:52 +0800 From: Chen Zhongjin To: , , , , , CC: , , , , , , , , , , , , , , Subject: [PATCH v6 32/33] arm64: irq-gic: Replace unreachable() with -EINVAL Date: Thu, 23 Jun 2022 09:49:16 +0800 Message-ID: <20220623014917.199563-33-chenzhongjin@huawei.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20220623014917.199563-1-chenzhongjin@huawei.com> References: <20220623014917.199563-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