cpu: Fix loading PowerPC vendor from cpu_map.xml

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.
This commit is contained in:
Jiri Denemark 2012-12-19 00:06:45 +01:00
parent 70349cb90d
commit ba8ba24711
2 changed files with 13 additions and 24 deletions

View File

@ -585,9 +585,10 @@
</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>

View 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