summaryrefslogtreecommitdiff
path: root/hw/ppc/spapr.c
diff options
context:
space:
mode:
authorGreg Kurz <groug@kaod.org>2020-09-14 14:35:00 +0200
committerDavid Gibson <david@gibson.dropbear.id.au>2020-10-09 10:15:06 +1100
commitcfdc52747390af88086094e51ddc7f8fbeea330e (patch)
tree875d5bd08e648b6d1c91d9478074fe624f014550 /hw/ppc/spapr.c
parentebd226d221c4ef8192fc5b148e0aece07bd302d1 (diff)
downloadqemu-cfdc52747390af88086094e51ddc7f8fbeea330e.zip
spapr: Add a return value to spapr_set_vcpu_id()
As recommended in "qapi/error.h", return true on success and false on failure. This allows to reduce error propagation overhead in the callers. Signed-off-by: Greg Kurz <groug@kaod.org> Message-Id: <20200914123505.612812-11-groug@kaod.org> Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com> Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Diffstat (limited to 'hw/ppc/spapr.c')
-rw-r--r--hw/ppc/spapr.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c
index 26b3432fe4..c6af456cfc 100644
--- a/hw/ppc/spapr.c
+++ b/hw/ppc/spapr.c
@@ -4286,7 +4286,7 @@ int spapr_get_vcpu_id(PowerPCCPU *cpu)
return cpu->vcpu_id;
}
-void spapr_set_vcpu_id(PowerPCCPU *cpu, int cpu_index, Error **errp)
+bool spapr_set_vcpu_id(PowerPCCPU *cpu, int cpu_index, Error **errp)
{
SpaprMachineState *spapr = SPAPR_MACHINE(qdev_get_machine());
MachineState *ms = MACHINE(spapr);
@@ -4299,10 +4299,11 @@ void spapr_set_vcpu_id(PowerPCCPU *cpu, int cpu_index, Error **errp)
error_append_hint(errp, "Adjust the number of cpus to %d "
"or try to raise the number of threads per core\n",
vcpu_id * ms->smp.threads / spapr->vsmt);
- return;
+ return false;
}
cpu->vcpu_id = vcpu_id;
+ return true;
}
PowerPCCPU *spapr_find_cpu(int vcpu_id)