From patchwork Wed Nov 13 05:18:18 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hardevsinh Palaniya X-Patchwork-Id: 13873162 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 2B016D41C02 for ; Wed, 13 Nov 2024 05:21:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:MIME-Version:Content-Type: Content-Transfer-Encoding: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:In-Reply-To:References:List-Owner; bh=BGpw6IhWulrLsx7SLcv4t5c4V/1E3UeVv54qVGXLm/U=; b=iQEv2ws3vxlqga6MofC7sbTtfk xd0bGoewBt6rSlUURUa/pRZBxutPo0y4mkpmn/GIZ1AvsXshb8zYcLvfTjMEct0lm5R5AiOHyGVsu m139b5Rw2jIBKZlN+wVTNWthI60i3BQVVwQsUtWeevthRd9NlOlmZtiS8xxi7mc29qaUvdUqfMxso dNaE0J9XXaQ1oDmTQZkC+lNpxq7Z2cn6npEhFgDbPwiub3symD8LdAOoAuHg77EZQ1I09uhZfs4CR Pkd8APCLL/LQf522CmTvByHNkCWgRezjBJ2tNHfNtS1/w3jhbzk3wGpmYoqnGeO9ypxaTvwdaqK6l DHqScBeA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tB5ot-00000005njM-1lPu; Wed, 13 Nov 2024 05:21:35 +0000 Received: from mail-centralindiaazlp170110003.outbound.protection.outlook.com ([2a01:111:f403:c408::3] helo=PNZPR01CU001.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1tB5n3-00000005nNA-0E2X for linux-arm-kernel@lists.infradead.org; Wed, 13 Nov 2024 05:19:42 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=V1XLjR1yKe8Vfp19EZa/K+rgG7ctVA0l4N2HO6gsUpB4f4+oDnCgnZP6A4zyke/r0rEvIgZthqYn+iwGYs2FZEgETYMpwq+bvWP0RXIhemV8WQ5nLftVnJQnTq6BCcXUK3OjJbAPySW/AW6woNqgO6dRFUR7lCPdxVAAxuzNwwXF8KwLB/G+43RcxSjzN4kC8H7KHxKbFtFk8hHWa9T1KPIq/+RP7i17ysNvsPm/tjTrg7V74xOgmrlDARR2wud5lsGAybyogt0opEn8d2T1FFbazNmCTHCnFhtn9m0vHmHawztoja9jjkBqE5FMI4CnvKQcWgCg6Yx7YXoXyGJCiQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=BGpw6IhWulrLsx7SLcv4t5c4V/1E3UeVv54qVGXLm/U=; b=izVdiqR84fIFCfRCZc2fIJyUEggtDFwI9KGuExzDfl33Y50Ry1K2iHgvNx4UYtaolEZLo4Xbt0q4q6OCXSI2sppe1nwA8HoO980n8J7O8yllGe7xXPH1C3IVWXe7uLltzknCXWk1iHlBN6aZkw5pqcCbYCWHvbHx2FG3TPgC7cLqrDvKpXU5yAkW4t5GAyW9MC7MMwZ+mrMtVhPhJYmdToyKNPG8nfxPWgYx5p1ix+nh5DwhLc1XQFZ5AGnMzcWIw8rIZ0b9AD+RRqi+AbjGcgqJYjPNDr5W4Pb8k6NiyVpstXfyH9wfBBqHIzRgYpDsJok7QZosenuQ9VVfUdPSGw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=siliconsignals.io; dmarc=pass action=none header.from=siliconsignals.io; dkim=pass header.d=siliconsignals.io; arc=none Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=siliconsignals.io; Received: from PN0P287MB2843.INDP287.PROD.OUTLOOK.COM (2603:1096:c01:204::8) by PN2P287MB1682.INDP287.PROD.OUTLOOK.COM (2603:1096:c01:1ac::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8137.28; Wed, 13 Nov 2024 05:19:28 +0000 Received: from PN0P287MB2843.INDP287.PROD.OUTLOOK.COM ([fe80::1134:92d7:1f68:2fac]) by PN0P287MB2843.INDP287.PROD.OUTLOOK.COM ([fe80::1134:92d7:1f68:2fac%3]) with mapi id 15.20.8137.027; Wed, 13 Nov 2024 05:19:28 +0000 From: Hardevsinh Palaniya To: broonie@kernel.org, will@kernel.org Cc: tarang.raval@siliconsignals.io, Hardevsinh Palaniya , Catalin Marinas , Marc Zyngier , Oliver Upton , Ard Biesheuvel , Mark Rutland , Joey Gouly , Ryan Roberts , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH v2] arm64: Refactor conditional logic Date: Wed, 13 Nov 2024 10:48:18 +0530 Message-ID: <20241113051852.4806-1-hardevsinh.palaniya@siliconsignals.io> X-Mailer: git-send-email 2.43.0 X-ClientProxiedBy: PN2PR01CA0238.INDPRD01.PROD.OUTLOOK.COM (2603:1096:c01:eb::8) To PN0P287MB2843.INDP287.PROD.OUTLOOK.COM (2603:1096:c01:204::8) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PN0P287MB2843:EE_|PN2P287MB1682:EE_ X-MS-Office365-Filtering-Correlation-Id: 9e48286a-80f9-4dc5-514f-08dd03a2bf42 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|366016|1800799024|52116014|7416014|376014|38350700014; X-Microsoft-Antispam-Message-Info: FkOqGmFeWSyZOxdBOv7McD1fVrtqJKpH4bDEYPHa5GN8zLnnXZyD90nmGpKFioifFiJWHsRKQw5lFp/ywO+titXCjgFsOifpm31OqgPac5I/ASQ3UggJ6TegLhBe16XqRwoH4NgCW4O9ms63CEbwNAvThOyYDHx2ZtVhsNxW/qVX2/rwm/QilM+59Pi6L6J7+62BU2iw1LsO8Lf/av5HoCQWHcFGhHgwCWI7zof0kqJbgnG+G+2CKDHAAmv2+1+rAhwl7Rw2HFNtzX1VcdKOA1KOoMVC52a9jTQI6m/3FlRVOpOwC+9M2ujwWZSkLpF4pdpvAzwsSL8LTdr1V8FlOb7zVpSFaj5xBKBIxP+U+SkEIZPPJufOZvG5UusRUpuDEVmaC6R5E+nkjd5dAG2lJTw2t1j2OQECGdeMA70ZKYublYIc3Q3dovzBkqQhtgPYuQp5/c058w5xRT16fqz1Jmr+aEJlu+W0/py/rZrbTw1a63tSRZ9nLbTT4aga4Ndru8GGcNMKCQi8B0yb8QF+U1Ag5I74busEvAFdqg38PX6+bqnpTK2z+W+G6SiQF7dDYOWXsG6nr5EmWyADjOkomlAg8iyef4PUtKaztJWFizSJjyw+48rCDv1PHdp0knsWKDerHa3Dn+hGG4Wfna8Xz/YxSgkbXWNytM2goceawgmww6TP+c0luHw2kRDf3C5oSgbKaL5/4eodSsmmN2FZXTKaBgov5kjbkpjL7jZH8rBc2oP8KX8PUHk46he6pmKfcE9zSvkxw7AJ139x/5vyJ8pTN60yFCjCKB0D7UrNdy4nusgfvDdMzvH8uS+BktdegKP+cdOcGU/uuaw2VjIIFMqfLkWy6DKGBYHBC6eFq2zjTa7X4KslDRI0tndfQFNvBU5kT1a5miypqhM+qsyp8rYysJE2woqtxpSYc4HleQQ2l+qI/DDH2luiWpQotmmXB16qZQprVRBbvf+N+Zc2A4cO7STgiPUJV4HCpsKItxnwP9fNGJQR6sbyTDezwPyX80N47Op7noWf7neNHXrWM+mdJeMTGFQuP3uQtWjV/IXu1T9yDSe3+zlCqPlt1KtrsInGGY1LU3mmsp77XWP08loyrXW+tj2Q6M46cRdiGK5BkF7dpZTbLlAh2hectqib/tTVUe6PVK2E0bNJlyafaShiCYenpf1y7/1Z2Dz2aDPMx5+MT6uTz4P4axeFilW6EUFiLLSpmejuULs7BNha8gHassUfSFOGzVV2qQv6n3/7yC3enbON0OS6KUVURFi3X0TOrsSYRocnZ3Q35hRueb5nW7zaEZHyB9LTWpmqPqvpwFsBcz6hTmMuK4pvSRokMzNKhpGhh7ZyOWocWtkeibKQmRlWIxA1BNB7PGTjEmU= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PN0P287MB2843.INDP287.PROD.OUTLOOK.COM;PTR:;CAT:NONE;SFS:(13230040)(366016)(1800799024)(52116014)(7416014)(376014)(38350700014);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: dqDo5vrxewFW6ONWXcSXl3t7/cT+VUWJ4P8cbyU/5Th06F1Pr8oMw6I7GZxjD077JUhF4r+7BYwqXPlxl7zef2Rklf+r0jCDKsEMKvFafiyrxitrgOM7McVlpPI/PmrQZyq6qbUnRDoXmqDMKZadrvJlma9e8jBx45Jf+mZyezxgdXIrGO3dFETutYHf4kQVIKqUupBqCqQLsuCS3m+a5QD4LZR+jbFoPNLrVxzickFz1l6OkoUTM9zaoTz07hfEkMoK3trrAK2xedHZ5+fp2YKtnn4wVlqiGQfpBKllQt99GeFm7yjIOvZfrg16YfZRXD3k8zKo97fJmNHq6BDNwhJvSvo+ueGRFHYmbVQ+w+yBmK8F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53E+UOa7AY20WMGWPGaRF6Y9umP1GDmSAHcAiW5IVfVvzmWLFDqpipN69sYlcHE/ZnYxoq3Eon7QAcsPkrqFw4EBHwi9sq6xiXZPl2L3VcscpLXfyS+ant30LT271xKtC50oeDqF8RPiK7e9PBc2mGGvjPb/KKD2aI2gxcFj1XXOIS1H1iy6/VP8THR5wzXnO1/QneeGENAkLq4K6ieiLsbHvCbRRkv4tMqy0CVf X-OriginatorOrg: siliconsignals.io X-MS-Exchange-CrossTenant-Network-Message-Id: 9e48286a-80f9-4dc5-514f-08dd03a2bf42 X-MS-Exchange-CrossTenant-AuthSource: PN0P287MB2843.INDP287.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Nov 2024 05:19:28.6215 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 7ec5089e-a433-4bd1-a638-82ee62e21d37 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: /QTOd6AOaSCq/BZSs9LeIOU/kVCjiN/KSMmHBaf7F77B7npALtRf/nFaDNfXKEgu+GOd04r85Df9T7ezoP87c1lTgkO2d4PegNL1SCnLqYd71QbbiADLWmsg7PzXN2Lg X-MS-Exchange-Transport-CrossTenantHeadersStamped: PN2P287MB1682 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241112_211941_120598_92E6EE01 X-CRM114-Status: GOOD ( 12.03 ) 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 Unnecessarily checks ftr_ovr == tmp in an extra else if, which is not needed because that condition would already be true by default if the previous conditions are not satisfied. Additionally, all branches set the variable str, making the subsequent "if (str)" check redundant Signed-off-by: Hardevsinh Palaniya Reviewed-by: Mark Brown --- Changelog in V2: - remove str check --- arch/arm64/kernel/cpufeature.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/arch/arm64/kernel/cpufeature.c b/arch/arm64/kernel/cpufeature.c index 718728a85430..728709483fb7 100644 --- a/arch/arm64/kernel/cpufeature.c +++ b/arch/arm64/kernel/cpufeature.c @@ -989,17 +989,16 @@ static void init_cpu_ftr_reg(u32 sys_reg, u64 new) /* Override was valid */ ftr_new = tmp; str = "forced"; - } else if (ftr_ovr == tmp) { + } else { /* Override was the safe value */ str = "already set"; } - if (str) - pr_warn("%s[%d:%d]: %s to %llx\n", - reg->name, - ftrp->shift + ftrp->width - 1, - ftrp->shift, str, - tmp & (BIT(ftrp->width) - 1)); + pr_warn("%s[%d:%d]: %s to %llx\n", + reg->name, + ftrp->shift + ftrp->width - 1, + ftrp->shift, str, + tmp & (BIT(ftrp->width) - 1)); } else if ((ftr_mask & reg->override->val) == ftr_mask) { reg->override->val &= ~ftr_mask; pr_warn("%s[%d:%d]: impossible override, ignored\n",