From patchwork Fri Nov 11 17:11:38 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 13040630 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 41533C433FE for ; Fri, 11 Nov 2022 17:18:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=4kCPsBwQ0pYBeDKpXTAhWBI3GemYuGYvt+a6sY9yVOY=; b=tMAL+znU8R6Man s1fkTQZD2eHXpDbZY9FmoW2eltsA2WiszRZCt3UjfqOKsRTlvhvlOkKucdGFTGy2NOctrhfu6r0GL OA4qPPAapxufHkSB5InPTgBc/44aoYqDglvdHM/yPJLvNky9Gq2WWAs/05cJ5Y99yR6suI4xgW5Cm tlSveBoDMOWXtT3lvgfpsdtC5fvmdbAH3r9gIB/kXTSI6aegJRWgjK2q9BgY9MxDVIXsFlgpomNY2 v5LqxwFGkg/r5vDD3mOC75UGsqPBHb+4ztkfnhuBX0ZzIXnFWU8+SpXY3IojUP9h95l1OZOrJtup5 JN/kX6o8rqaHSU5TEeOg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1otXeU-00HADf-VO; Fri, 11 Nov 2022 17:17:15 +0000 Received: from dfw.source.kernel.org ([2604:1380:4641:c500::1]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1otXa6-00H7fB-Dv for linux-arm-kernel@lists.infradead.org; Fri, 11 Nov 2022 17:12:43 +0000 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 0E7256206C; Fri, 11 Nov 2022 17:12:42 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 91C7FC433B5; Fri, 11 Nov 2022 17:12:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1668186761; bh=EOI1RlNeS2R2j+GU3HS6zPXW1KCWLwxVJVn7Af6Hd5A=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=HpF7oc+UtUJ6a+6uIOGnlhoCXAKrbedZxLZxbcCiuK0adz96oLOKfEDoH6MV3bFaI ewc3T+1RFgi35LDDJqkfGbeGFAW6qDcSXHjbWGPC0TXbaXAXaIv/5xYtTj/elvOuLt WfmAoZ3sw64IvMzCMVUKw5Ujm1GWlMsxR8qgZ8cb/DQQzCfekeC51F7gjVMkWD0cSg +fUXhhNTghM663GS4uS+mztxUbWabA6Pv6ZXraziEDnFxxHzhEjgwF1VbuaOZ8xUEq d8pKI6wkbwYslwe/CdY02Wm6C9vK1weRDUCmwb7jkeFydiYnr1yMHHttJEYkJlBL4g 0eTMasWOHGZJw== From: Ard Biesheuvel To: linux-arm-kernel@lists.infradead.org Cc: Ard Biesheuvel , Marc Zyngier , Will Deacon , Mark Rutland , Kees Cook , Catalin Marinas , Mark Brown , Anshuman Khandual Subject: [PATCH v7 10/33] arm64: idreg-override: Omit non-NULL checks for override pointer Date: Fri, 11 Nov 2022 18:11:38 +0100 Message-Id: <20221111171201.2088501-11-ardb@kernel.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20221111171201.2088501-1-ardb@kernel.org> References: <20221111171201.2088501-1-ardb@kernel.org> MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1672; i=ardb@kernel.org; h=from:subject; bh=EOI1RlNeS2R2j+GU3HS6zPXW1KCWLwxVJVn7Af6Hd5A=; b=owEB7QES/pANAwAKAcNPIjmS2Y8kAcsmYgBjboI5TxsBMdfCcEUbwz9KagMKCw2cvi6Imb1AkF38 OJHAYMKJAbMEAAEKAB0WIQT72WJ8QGnJQhU3VynDTyI5ktmPJAUCY26COQAKCRDDTyI5ktmPJA0FDA CqpBCbEBuO5eWenxkU2VeAfELtCDinrQjKU7oVSqCJPQhB4/GfxrklEj1Bz3L9kGTh+tPke49+CmOM uKikeyZrd5FOANnl8M5lC5DkXkLbZ80ohilXjA54AFUhqezVn5loWWDghlaSkdT3yc0COIcuujFNFe RD6aFitSuIZCAaDEFcfvNv9Qlcec6KUEfgClZTwpHZ3ns1dMT/IQ35EVM9Yam8AvZV7yh+XCZG/axM 90JX/hvFj41amK95aVanqZrfx+t9vZ7kIbYuICYtUT8gTOgFH6zNAK+zSEbx0RbKVSN7CBWyDnnv1e AtDUmE+53hXdsOQxcTrOoSaHPXOqoHCbTFKDWOgNAC79VZX928jpn1bkT78N8zwxOGVI26UdWjalkh qUxjOsJyHpRKOic6UQAn3mhGvosZpHtmZgKWkp7jnKp7VI2t546jt2O13YRGG7q0YGehk7D4AzEvbi J27b3uaq/dQ9RxtSBOF4oiaE7nDs9/+czOQ2PHzjXVYQw= X-Developer-Key: i=ardb@kernel.org; a=openpgp; fpr=F43D03328115A198C90016883D200E9CA6329909 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20221111_091242_568239_C67C3D17 X-CRM114-Status: GOOD ( 14.50 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Now that override pointers are always set, we can drop the various non-NULL checks that we have in the code. Signed-off-by: Ard Biesheuvel --- arch/arm64/kernel/idreg-override.c | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/arch/arm64/kernel/idreg-override.c b/arch/arm64/kernel/idreg-override.c index 4e8ef5e05db7a424..d7fc813ba5913e27 100644 --- a/arch/arm64/kernel/idreg-override.c +++ b/arch/arm64/kernel/idreg-override.c @@ -195,9 +195,6 @@ static void __init match_options(const char *cmdline) for (i = 0; i < ARRAY_SIZE(regs); i++) { int f; - if (!regs[i]->override) - continue; - for (f = 0; strlen(regs[i]->fields[f].name); f++) { u64 shift = regs[i]->fields[f].shift; u64 width = regs[i]->fields[f].width ?: 4; @@ -298,10 +295,8 @@ asmlinkage void __init init_feature_override(u64 boot_status) int i; for (i = 0; i < ARRAY_SIZE(regs); i++) { - if (regs[i]->override) { - regs[i]->override->val = 0; - regs[i]->override->mask = 0; - } + regs[i]->override->val = 0; + regs[i]->override->mask = 0; } __boot_status = boot_status; @@ -309,9 +304,8 @@ asmlinkage void __init init_feature_override(u64 boot_status) parse_cmdline(); for (i = 0; i < ARRAY_SIZE(regs); i++) { - if (regs[i]->override) - dcache_clean_inval_poc((unsigned long)regs[i]->override, - (unsigned long)regs[i]->override + - sizeof(*regs[i]->override)); + dcache_clean_inval_poc((unsigned long)regs[i]->override, + (unsigned long)regs[i]->override + + sizeof(*regs[i]->override)); } }