mirror of
https://github.com/utmapp/qemu.git
synced 2026-12-01 22:23:23 -10:00
hw/loongarch/virt: Fix cpuslot::cpu set at last in virt_cpu_plug()
In function virt_cpu_plug(), Object cpuslot::cpu is set at last
only when there is no any error, otherwise it is problematic that
cpuslot::cpu is set in advance however it returns because of error.
Fixes: ab9935d299 (hw/loongarch/virt: Implement cpu plug interface)
Signed-off-by: Bibo Mao <[email protected]>
Reviewed-by: Markus Armbruster <[email protected]>
Message-Id: <[email protected]>
Signed-off-by: Song Gao <[email protected]>
This commit is contained in:
1 parent
dfaecc04c4
commit
988ad4cceb
1 file changed
+2
-2
+2
-2
@@ -973,8 +973,6 @@ static void virt_cpu_plug(HotplugHandler *hotplug_dev,
|
||||
LoongArchVirtMachineState *lvms = LOONGARCH_VIRT_MACHINE(hotplug_dev);
|
||||
Error *err = NULL;
|
||||
|
||||
cpu_slot = virt_find_cpu_slot(MACHINE(lvms), cpu->phy_id);
|
||||
cpu_slot->cpu = CPU(dev);
|
||||
if (lvms->ipi) {
|
||||
hotplug_handler_plug(HOTPLUG_HANDLER(lvms->ipi), dev, &err);
|
||||
if (err) {
|
||||
@@ -998,6 +996,8 @@ static void virt_cpu_plug(HotplugHandler *hotplug_dev,
|
||||
}
|
||||
}
|
||||
|
||||
cpu_slot = virt_find_cpu_slot(MACHINE(lvms), cpu->phy_id);
|
||||
cpu_slot->cpu = CPU(dev);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user