Received: by 2002:a05:6602:18e:0:0:0:0 with SMTP id m14csp5867835ioo; Wed, 1 Jun 2022 14:29:58 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzI9FQMNBxJNWEcGALEwCYTXhmrBaLT0L4GBQZ7yuM7+MJ0vdeBcUaRuwpG3U42iC8lRqdM X-Received: by 2002:a17:90b:341:b0:1e0:cf43:df4f with SMTP id fh1-20020a17090b034100b001e0cf43df4fmr1449924pjb.126.1654118998666; Wed, 01 Jun 2022 14:29:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654118998; cv=none; d=google.com; s=arc-20160816; b=OYKTm1xxc5tH5xJ2KkMGJRiPJqjYYTg4UcDVlHy5vTyrw9Pb0GjWknjYeTuqcs+tQ0 6YkT6VlAwM5lia0iVvFISEk5o5zWiN2zPOqTPvsdkOSrOIdfGyO5KlLDigkX1qerkPFR x6NBwYFnS53JmEPNmpqfATl4B6AQHHRG2e7/wnlNL7cXs6hZ9ef/7IyF7XwqDKdI2+Bn lUALVfAK33jxkHOrgr8F2GO8574SXfxEHWG3RphNIAn0tBDLnMNfQIWQdhryo4cilJEC wmtlyMSlwSvx4RasmTMDEPhBzuLoxujjCvFG1ZZZAWQtkckpfmcAaSKBrcd0xKeGTajh X9cQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=S4bVw6gq8t0WVuGgY2zAvilf+MdDU3JFmE5ha/acZfM=; b=v8GXqgzliHsXzvG6rrUvjPn+zSBI3nBGQOckAXvaTJzZhLWSJ5KKMLiq0Dq11wuJnd IZtX8GmUMQlYO3+24rkhAZtASrezYHJ7UHeG46/TagjngItODF1kie3zGVwWADF72uWg 5pMkqo8mxNhzpql4q18zfZscH/UWZIaQJ4Lx+XcB9nl6m1vrM2jpZJdWG0ybRQ8KVT30 jMSHFXPLeJG7iXWTdwpNZHAwmezeNW1NbhZOdBG0q1rc/LtjLQEViNOJiCmNQDdsNU1h UpUB2tBt6s9JGDZAFi/rh9xtxS3y2Sncx8YDj5vWEqIQZfY3ujaYKEsVQfA0xaye+8a8 uDAQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=oIcEsTH3; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id g71-20020a636b4a000000b003fbcd6ec5basi3645068pgc.712.2022.06.01.14.29.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 01 Jun 2022 14:29:58 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=oIcEsTH3; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 45CBA25068A; Wed, 1 Jun 2022 13:19:55 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1352753AbiFAMaP (ORCPT + 99 others); Wed, 1 Jun 2022 08:30:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41690 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1352904AbiFAMaN (ORCPT ); Wed, 1 Jun 2022 08:30:13 -0400 Received: from mail-pj1-x102c.google.com (mail-pj1-x102c.google.com [IPv6:2607:f8b0:4864:20::102c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A106A87A29 for ; Wed, 1 Jun 2022 05:30:12 -0700 (PDT) Received: by mail-pj1-x102c.google.com with SMTP id o6-20020a17090a0a0600b001e2c6566046so6112053pjo.0 for ; Wed, 01 Jun 2022 05:30:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=S4bVw6gq8t0WVuGgY2zAvilf+MdDU3JFmE5ha/acZfM=; b=oIcEsTH3b5mXEb2Ia3i3UOeqlsqcRq8MBSyLyQThDEvng01ryIwMf03NfLD3AKtbk3 jw6b7seXRuczB3gqFUYEdO5Xp/xEl3W7cT8yrgUpB8ReMyAVDbDLLiaJEhPuKEDZmoah rxIImweKZEk32i1HxGQ+uiDC9PXZ530B0wZR91ZTcGbAZirLIWVo8q0ufuiR8RXmZc1G cu/jfkhVi7d1fihVY8L+mMaQjrz0rN/KeYaXsj+/E63vy9PPqLqSKfKhKRoeZIlAvLrW ACZTebUc0fmGCeWL+YbY2M6lHkS7rECGmQrSkrmiTeFdVfxBWDq61LekP92CT8eUdZPY ZyYw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=S4bVw6gq8t0WVuGgY2zAvilf+MdDU3JFmE5ha/acZfM=; b=w3MUZ/AvbVwcz/oXIFu92I26K1sGQjT7vlGduyXf3G8CerPLxrleAXcQajmuNlz0uO KvUGwNiZSjwDyIm06gmCZLWDnzFjmTNllv+zHCTh3XQloMqGssx4/Xsz8ZQnvZzDYkM2 rm3ZHKlUrOayDnRoKOuuk/eJ+Y/zVgIWXHSkl8sE3eOL9Be4gVh0YR4y0arVl/Er8ioJ +6PrWjJEcXCdwDiGUXq1IQLLLMwmjmlrVR04Xa7eWIxCJUTtSG/EJC+B36PdDHJ8OSt+ TJ0gihYVQjFxEcqCek6/sX8bHbOa65VqEG2vxF3jfgkWFk6VG7RJx4oFbH3mn3DwOOE5 wLYA== X-Gm-Message-State: AOAM531K6dN9W3BvidoEVe8ZrMKUQrHC81d0x7UWED0Q9NNEPrJ7lAFV 6+D10VO2sAyU05wsSiIvbGU= X-Received: by 2002:a17:90b:214b:b0:1e2:d777:934f with SMTP id kt11-20020a17090b214b00b001e2d777934fmr19989630pjb.193.1654086612156; Wed, 01 Jun 2022 05:30:12 -0700 (PDT) Received: from localhost.localdomain ([43.132.141.4]) by smtp.gmail.com with ESMTPSA id g3-20020aa78743000000b0050dc7628163sm1352451pfo.61.2022.06.01.05.30.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 01 Jun 2022 05:30:11 -0700 (PDT) From: Yuntao Wang To: Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , x86@kernel.org Cc: "H . Peter Anvin" , linux-kernel@vger.kernel.org, Yuntao Wang Subject: [PATCH] x86/setup: Move duplicate variable definition out of the if/else block Date: Wed, 1 Jun 2022 20:29:14 +0800 Message-Id: <20220601122914.820890-1-ytcoode@gmail.com> X-Mailer: git-send-email 2.36.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RDNS_NONE, SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no 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 Both the if and else blocks define an exact same boot_cpu_data variable, move the duplicate variable definition out of the if/else block. In addition, this patch also does some other minor cleanups. Signed-off-by: Yuntao Wang --- arch/x86/kernel/e820.c | 4 ++-- arch/x86/kernel/setup.c | 10 ++-------- 2 files changed, 4 insertions(+), 10 deletions(-) diff --git a/arch/x86/kernel/e820.c b/arch/x86/kernel/e820.c index f267205f2d5a..06ece49ac812 100644 --- a/arch/x86/kernel/e820.c +++ b/arch/x86/kernel/e820.c @@ -395,7 +395,7 @@ int __init e820__update_table(struct e820_table *table) /* Continue building up new map based on this information: */ if (current_type != last_type || e820_nomerge(current_type)) { - if (last_type != 0) { + if (last_type != 0) { new_entries[new_nr_entries].size = change_point[chg_idx]->addr - last_addr; /* Move forward only if the new size was non-zero: */ if (new_entries[new_nr_entries].size != 0) @@ -403,7 +403,7 @@ int __init e820__update_table(struct e820_table *table) if (++new_nr_entries >= max_nr_entries) break; } - if (current_type != 0) { + if (current_type != 0) { new_entries[new_nr_entries].addr = change_point[chg_idx]->addr; new_entries[new_nr_entries].type = current_type; last_addr = change_point[chg_idx]->addr; diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c index c95b9ac5a457..bb3451d3e548 100644 --- a/arch/x86/kernel/setup.c +++ b/arch/x86/kernel/setup.c @@ -115,11 +115,6 @@ static struct resource bss_resource = { #ifdef CONFIG_X86_32 /* CPU data as detected by the assembly code in head_32.S */ struct cpuinfo_x86 new_cpu_data; - -/* Common CPU data for all CPUs */ -struct cpuinfo_x86 boot_cpu_data __read_mostly; -EXPORT_SYMBOL(boot_cpu_data); - unsigned int def_to_bigsmp; struct apm_info apm_info; @@ -133,11 +128,10 @@ EXPORT_SYMBOL(ist_info); struct ist_info ist_info; #endif -#else -struct cpuinfo_x86 boot_cpu_data __read_mostly; -EXPORT_SYMBOL(boot_cpu_data); #endif +struct cpuinfo_x86 boot_cpu_data __read_mostly; +EXPORT_SYMBOL(boot_cpu_data); #if !defined(CONFIG_X86_PAE) || defined(CONFIG_X86_64) __visible unsigned long mmu_cr4_features __ro_after_init; -- 2.36.0