mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-02-12 22:51:29 +00:00
cpu_x86: Use for loop in x86Decode
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
This commit is contained in:
parent
2085f9a514
commit
aa9e0ef0ef
@ -1626,8 +1626,7 @@ x86Decode(virCPUDefPtr cpu,
|
|||||||
if (!data || !(map = virCPUx86GetMap()))
|
if (!data || !(map = virCPUx86GetMap()))
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
candidate = map->models;
|
for (candidate = map->models; candidate; candidate = candidate->next) {
|
||||||
while (candidate != NULL) {
|
|
||||||
if (!cpuModelIsAllowed(candidate->name, models, nmodels)) {
|
if (!cpuModelIsAllowed(candidate->name, models, nmodels)) {
|
||||||
if (preferred && STREQ(candidate->name, preferred)) {
|
if (preferred && STREQ(candidate->name, preferred)) {
|
||||||
if (cpu->fallback != VIR_CPU_FALLBACK_ALLOW) {
|
if (cpu->fallback != VIR_CPU_FALLBACK_ALLOW) {
|
||||||
@ -1644,7 +1643,7 @@ x86Decode(virCPUDefPtr cpu,
|
|||||||
VIR_DEBUG("CPU model %s not allowed by hypervisor; ignoring",
|
VIR_DEBUG("CPU model %s not allowed by hypervisor; ignoring",
|
||||||
candidate->name);
|
candidate->name);
|
||||||
}
|
}
|
||||||
goto next;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(cpuCandidate = x86DataToCPU(data, candidate, map)))
|
if (!(cpuCandidate = x86DataToCPU(data, candidate, map)))
|
||||||
@ -1657,7 +1656,7 @@ x86Decode(virCPUDefPtr cpu,
|
|||||||
candidate->vendor->name, candidate->name,
|
candidate->vendor->name, candidate->name,
|
||||||
cpuCandidate->vendor);
|
cpuCandidate->vendor);
|
||||||
virCPUDefFree(cpuCandidate);
|
virCPUDefFree(cpuCandidate);
|
||||||
goto next;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((rc = x86DecodeUseCandidate(cpuModel, cpuCandidate, preferred,
|
if ((rc = x86DecodeUseCandidate(cpuModel, cpuCandidate, preferred,
|
||||||
@ -1670,9 +1669,6 @@ x86Decode(virCPUDefPtr cpu,
|
|||||||
} else {
|
} else {
|
||||||
virCPUDefFree(cpuCandidate);
|
virCPUDefFree(cpuCandidate);
|
||||||
}
|
}
|
||||||
|
|
||||||
next:
|
|
||||||
candidate = candidate->next;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cpuModel == NULL) {
|
if (cpuModel == NULL) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user