Skip to content

Commit 81bd606

Browse files
calmisibonzini
authored andcommitted
i386/cpu: Drop the variable smp_cores and smp_threads in x86_cpu_pre_plug()
No need to define smp_cores and smp_threads, just using ms->smp.cores and ms->smp.threads is straightforward. It's also consistent with other checks of socket/die/module. Signed-off-by: Xiaoyao Li <[email protected]> Reviewed-by: Zhao Liu <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Paolo Bonzini <[email protected]>
1 parent d3bb5d0 commit 81bd606

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

hw/i386/x86-common.c

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -248,8 +248,6 @@ void x86_cpu_pre_plug(HotplugHandler *hotplug_dev,
248248
CPUX86State *env = &cpu->env;
249249
MachineState *ms = MACHINE(hotplug_dev);
250250
X86MachineState *x86ms = X86_MACHINE(hotplug_dev);
251-
unsigned int smp_cores = ms->smp.cores;
252-
unsigned int smp_threads = ms->smp.threads;
253251
X86CPUTopoInfo topo_info;
254252

255253
if (!object_dynamic_cast(OBJECT(cpu), ms->cpu_type)) {
@@ -329,17 +327,17 @@ void x86_cpu_pre_plug(HotplugHandler *hotplug_dev,
329327
if (cpu->core_id < 0) {
330328
error_setg(errp, "CPU core-id is not set");
331329
return;
332-
} else if (cpu->core_id > (smp_cores - 1)) {
330+
} else if (cpu->core_id > (ms->smp.cores - 1)) {
333331
error_setg(errp, "Invalid CPU core-id: %u must be in range 0:%u",
334-
cpu->core_id, smp_cores - 1);
332+
cpu->core_id, ms->smp.cores - 1);
335333
return;
336334
}
337335
if (cpu->thread_id < 0) {
338336
error_setg(errp, "CPU thread-id is not set");
339337
return;
340-
} else if (cpu->thread_id > (smp_threads - 1)) {
338+
} else if (cpu->thread_id > (ms->smp.threads - 1)) {
341339
error_setg(errp, "Invalid CPU thread-id: %u must be in range 0:%u",
342-
cpu->thread_id, smp_threads - 1);
340+
cpu->thread_id, ms->smp.threads - 1);
343341
return;
344342
}
345343

0 commit comments

Comments
 (0)