]> xenbits.xensource.com Git - libvirt.git/commitdiff
Move models/nmodels mismatch checking one level up
authorJiri Denemark <jdenemar@redhat.com>
Mon, 1 Feb 2010 11:42:27 +0000 (12:42 +0100)
committerJim Meyering <meyering@redhat.com>
Mon, 1 Feb 2010 16:20:27 +0000 (17:20 +0100)
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
src/cpu/cpu.c
src/cpu/cpu_x86.c

index 975ca28f64867105b6219d7d0ce12eef54c48c8e..3e46948214f045b92979999fd9f99b0f1ac79177 100644 (file)
@@ -128,6 +128,12 @@ cpuDecode(virConnectPtr conn,
 {
     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) {
         virCPUReportError(conn, VIR_ERR_INTERNAL_ERROR,
                           "%s", _("invalid CPU definition"));
index 47dc400ea5cf2a93425a89f5a8439d7a9cfc107d..ce55588252d311dbb1e72d5d4e42efc60c54e34a 100644 (file)
@@ -954,9 +954,6 @@ x86Decode(virCPUDefPtr cpu,
     if (data == NULL || (map = x86LoadMap()) == NULL)
         return -1;
 
-    if (models == NULL && nmodels != 0)
-        return -1;
-
     candidate = map->models;
     while (candidate != NULL) {
         bool allowed = (models == NULL);