In function virt_cpu_plug() and virt_cpu_unplug(), the error is impossile. Destination error is not propagated and replaced with error_abort. With this, the logic is simple.
Also there is bugfix in function virt_cpu_plug(), Object cpuslot::cpu is set at last only when there is no any error. --- v6 ... v7: 1. Replace dest error from parameter errp with error_abort since the error is impossible. 2. Some patches are merged, refresh the pending two patches. v5 ... v6: 1. If there is nested error report when restore from error in function virt_cpu_plug(), set output Error object with &error_abort rather than NULL, since it is almost impossible now. 2. If there is nested error report when restore from error in function virt_cpu_unplug(), set output Error object with &error_abort rather than NULL, since it is almost impossible now. v4 ... v5: 1. Split patch2 in v4 into three small patches, two are fixup for error handing when cpu plug/unplug fails so that system can continue to run, one is to remove error_propagate() and refresh title. 2. Refresh changelog in last patch and remove fixes information since it is impossible to happen. v3 ... v4: 1. Add missed this cleanup with error and remove some local error object. 2. Replace local error object with error_abort object in virt_cpu_irq_init(), since its return value is not checked. v2 ... v3: 1. Add missing modification replacing error_propagate() + error_setg() with error_setg(). 2. Some enhancement about error handling, handling error symmetrically in many places v1 ... v2: 1. Add fixes tag and change title with fix prefix in patch 1. 2. Replace error_propagate() with error_setg(), and return directly for any error. --- Bibo Mao (2): hw/loongarch/virt: Fix cpuslot::cpu set at last in virt_cpu_plug() hw/loongarch/virt: Replace destination error with error_abort hw/loongarch/virt.c | 43 +++++++++---------------------------------- 1 file changed, 9 insertions(+), 34 deletions(-) base-commit: 71119ed3651622e1c531d1294839e9f3341adaf5 -- 2.39.3