]> xenbits.xensource.com Git - libvirt.git/commitdiff
cpu: Fix loading PowerPC vendor from cpu_map.xml
authorJiri Denemark <jdenemar@redhat.com>
Tue, 18 Dec 2012 23:06:45 +0000 (00:06 +0100)
committerJiri Denemark <jdenemar@redhat.com>
Fri, 19 Apr 2013 12:33:16 +0000 (14:33 +0200)
When ppcVendorLoad fails to parse the vendor element for whatever
reason, it is supposed to ignore it and return 0 rather than -1. The
patch also removes PowerPC vendor string from the XML as it is not
actually used for anything.

src/cpu/cpu_map.xml
src/cpu/cpu_powerpc.c

index eb69a3428444b2a97ee008779f2ce17b084bee2e..ba8c17dfe475a8d9ce26bf2386eb7ab68d419a95 100644 (file)
     </model>
   </arch>
   <arch name='ppc64'>
-   <!-- vendor definitions -->
-    <vendor name='IBM' string='PowerPC'/>
-   <!-- IBM-based CPU models -->
+    <!-- vendor definitions -->
+    <vendor name='IBM'/>
+
+    <!-- IBM-based CPU models -->
     <model name='POWER7'>
       <vendor name='IBM'/>
     </model>
index 64e6ec8a7b30934310972cfa8fa7775a6b4471c7..c17c8cdfdb6acd800581a1cd28e3a09f15831e8a 100644 (file)
@@ -203,11 +203,11 @@ ppcVendorLoad(xmlXPathContextPtr ctxt,
               struct ppc_map *map)
 {
     struct ppc_vendor *vendor = NULL;
-    char *string = NULL;
-    int ret = -1;
 
-    if (VIR_ALLOC(vendor) < 0)
-        goto no_memory;
+    if (VIR_ALLOC(vendor) < 0) {
+        virReportOOMError();
+        return -1;
+    }
 
     vendor->name = virXPathString("string(@name)", ctxt);
     if (!vendor->name) {
@@ -222,31 +222,19 @@ ppcVendorLoad(xmlXPathContextPtr ctxt,
         goto ignore;
     }
 
-    string = virXPathString("string(@string)", ctxt);
-    if (!string) {
-        virReportError(VIR_ERR_INTERNAL_ERROR,
-                       _("Missing vendor string for CPU vendor %s"), vendor->name);
-        goto ignore;
-    }
-    if (!map->vendors)
+    if (!map->vendors) {
         map->vendors = vendor;
-    else {
+    else {
         vendor->next = map->vendors;
         map->vendors = vendor;
     }
 
-    ret = 0;
-
-out:
-    VIR_FREE(string);
-    return ret;
-
-no_memory:
-    virReportOOMError();
+cleanup:
+    return 0;
 
 ignore:
     ppcVendorFree(vendor);
-    goto out;
+    goto cleanup;
 }
 
 static int