Move models/nmodels mismatch checking one level up

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
This commit is contained in:
Jiri Denemark 2010-02-01 12:42:27 +01:00 committed by Jim Meyering
parent 0ea0128904
commit 1e44c678fa
2 changed files with 6 additions and 3 deletions

View File

@ -128,6 +128,12 @@ cpuDecode(virConnectPtr conn,
{ {
struct cpuArchDriver *driver; struct cpuArchDriver *driver;
if (models == NULL && nmodels != 0) {
virCPUReportError(conn, VIR_ERR_INTERNAL_ERROR,
"%s", _("nonzero nmodels doesn't match with NULL models"));
return -1;
}
if (cpu == NULL) { if (cpu == NULL) {
virCPUReportError(conn, VIR_ERR_INTERNAL_ERROR, virCPUReportError(conn, VIR_ERR_INTERNAL_ERROR,
"%s", _("invalid CPU definition")); "%s", _("invalid CPU definition"));

View File

@ -954,9 +954,6 @@ x86Decode(virCPUDefPtr cpu,
if (data == NULL || (map = x86LoadMap()) == NULL) if (data == NULL || (map = x86LoadMap()) == NULL)
return -1; return -1;
if (models == NULL && nmodels != 0)
return -1;
candidate = map->models; candidate = map->models;
while (candidate != NULL) { while (candidate != NULL) {
bool allowed = (models == NULL); bool allowed = (models == NULL);