Skip to content

Commit 50c66d7

Browse files
ytcoodebp3tk0v
authored andcommitted
x86/setup: Move duplicate boot_cpu_data definition out of the ifdeffery
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, do some other minor cleanups. [ bp: Massage. ] Signed-off-by: Yuntao Wang <[email protected]> Signed-off-by: Borislav Petkov (AMD) <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent b7d1f15 commit 50c66d7

File tree

2 files changed

+4
-10
lines changed

2 files changed

+4
-10
lines changed

arch/x86/kernel/e820.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -395,15 +395,15 @@ int __init e820__update_table(struct e820_table *table)
395395

396396
/* Continue building up new map based on this information: */
397397
if (current_type != last_type || e820_nomerge(current_type)) {
398-
if (last_type != 0) {
398+
if (last_type) {
399399
new_entries[new_nr_entries].size = change_point[chg_idx]->addr - last_addr;
400400
/* Move forward only if the new size was non-zero: */
401401
if (new_entries[new_nr_entries].size != 0)
402402
/* No more space left for new entries? */
403403
if (++new_nr_entries >= max_nr_entries)
404404
break;
405405
}
406-
if (current_type != 0) {
406+
if (current_type) {
407407
new_entries[new_nr_entries].addr = change_point[chg_idx]->addr;
408408
new_entries[new_nr_entries].type = current_type;
409409
last_addr = change_point[chg_idx]->addr;

arch/x86/kernel/setup.c

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -114,11 +114,6 @@ static struct resource bss_resource = {
114114
#ifdef CONFIG_X86_32
115115
/* CPU data as detected by the assembly code in head_32.S */
116116
struct cpuinfo_x86 new_cpu_data;
117-
118-
/* Common CPU data for all CPUs */
119-
struct cpuinfo_x86 boot_cpu_data __read_mostly;
120-
EXPORT_SYMBOL(boot_cpu_data);
121-
122117
unsigned int def_to_bigsmp;
123118

124119
struct apm_info apm_info;
@@ -132,11 +127,10 @@ EXPORT_SYMBOL(ist_info);
132127
struct ist_info ist_info;
133128
#endif
134129

135-
#else
136-
struct cpuinfo_x86 boot_cpu_data __read_mostly;
137-
EXPORT_SYMBOL(boot_cpu_data);
138130
#endif
139131

132+
struct cpuinfo_x86 boot_cpu_data __read_mostly;
133+
EXPORT_SYMBOL(boot_cpu_data);
140134

141135
#if !defined(CONFIG_X86_PAE) || defined(CONFIG_X86_64)
142136
__visible unsigned long mmu_cr4_features __ro_after_init;

0 commit comments

Comments
 (0)