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.
</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>
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) {
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