From patchwork Thu Feb 29 10:52:08 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Liao Chang X-Patchwork-Id: 13576966 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 50C74C48BF6 for ; Thu, 29 Feb 2024 10:57:46 +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: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=Tchs3WtazR2oUiYpZ9JuFuRn/gu6WjU1uztgyad32BI=; b=o5oG2ilYOoEjAc BZJOa+O1lKOn3bAE40it/hhmbIxOgLg/qLz4fDY/qFa4KcIIgvNJZ7zlAS24nX6dUqu1PJX7v6bds wNIwGOmjKvwE4/WUkLge51B1HUTsNO0tSjsPSlks1JuXPdIxZsYn976TBfXY6MRC0YsiZPWgmi254 jbuH+Xd9L+7E9tF5L6O6meIwwv5rkW/wzHTqn5AL93lnG2QL6qSpZX6XJWqiWWRWkFg0nt7PeYGk8 lIP5w4S7qVZWkPHXpdTyl+NcMYHXKrRJcjpk8mqpapZYqvi+g4sI1PUPu4BwONBp8a2Su9YN8KEqx M/DXQWg+Wh4PBVLl4zoA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rfe6b-0000000DG5T-17Ua; Thu, 29 Feb 2024 10:57:37 +0000 Received: from szxga04-in.huawei.com ([45.249.212.190]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rfe6X-0000000DG4n-47DR for linux-arm-kernel@lists.infradead.org; Thu, 29 Feb 2024 10:57:35 +0000 Received: from mail.maildlp.com (unknown [172.19.88.234]) by szxga04-in.huawei.com (SkyGuard) with ESMTP id 4Tlp5l1mq0z2BdZj; Thu, 29 Feb 2024 18:55:07 +0800 (CST) Received: from kwepemd100005.china.huawei.com (unknown [7.221.188.91]) by mail.maildlp.com (Postfix) with ESMTPS id 1FAC5140390; Thu, 29 Feb 2024 18:57:23 +0800 (CST) Received: from kwepemd200013.china.huawei.com (7.221.188.133) by kwepemd100005.china.huawei.com (7.221.188.91) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1258.28; Thu, 29 Feb 2024 18:57:22 +0800 Received: from huawei.com (10.67.174.28) by kwepemd200013.china.huawei.com (7.221.188.133) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1258.28; Thu, 29 Feb 2024 18:57:22 +0800 From: Liao Chang To: , , , , , , , , , CC: , Subject: [PATCH] arm64: cpufeatures: Clean up temporary variable to simplify code Date: Thu, 29 Feb 2024 10:52:08 +0000 Message-ID: <20240229105208.456704-1-liaochang1@huawei.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-Originating-IP: [10.67.174.28] X-ClientProxiedBy: dggems703-chm.china.huawei.com (10.3.19.180) To kwepemd200013.china.huawei.com (7.221.188.133) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240229_025734_204209_12E591A2 X-CRM114-Status: GOOD ( 10.47 ) 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 Clean up one temporary variable to simplifiy code in capability detection. Signed-off-by: Liao Chang Acked-by: Mark Rutland Reviewed-by: Jeremy Linton --- arch/arm64/kernel/cpufeature.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/arch/arm64/kernel/cpufeature.c b/arch/arm64/kernel/cpufeature.c index 8d1a634a403e..0e900b23f7ab 100644 --- a/arch/arm64/kernel/cpufeature.c +++ b/arch/arm64/kernel/cpufeature.c @@ -3052,13 +3052,9 @@ static void __init enable_cpu_capabilities(u16 scope_mask) boot_scope = !!(scope_mask & SCOPE_BOOT_CPU); for (i = 0; i < ARM64_NCAPS; i++) { - unsigned int num; - caps = cpucap_ptrs[i]; - if (!caps || !(caps->type & scope_mask)) - continue; - num = caps->capability; - if (!cpus_have_cap(num)) + if (!caps || !(caps->type & scope_mask) || + !cpus_have_cap(caps->capability)) continue; if (boot_scope && caps->cpu_enable)