mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-08-28 19:41:16 +00:00
cpu: Use g_auto* in virCPUGetHost
Signed-off-by: Tim Wiederhake <twiederh@redhat.com> Reviewed-by: Ján Tomko <jtomko@redhat.com> Signed-off-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
parent
ca1c9716cc
commit
d369264a99
@ -378,7 +378,7 @@ virCPUGetHost(virArch arch,
|
||||
virDomainCapsCPUModelsPtr models)
|
||||
{
|
||||
struct cpuArchDriver *driver;
|
||||
virCPUDefPtr cpu = NULL;
|
||||
g_autoptr(virCPUDef) cpu = NULL;
|
||||
|
||||
VIR_DEBUG("arch=%s, type=%s, nodeInfo=%p, models=%p",
|
||||
virArchToString(arch), virCPUTypeToString(type), nodeInfo,
|
||||
@ -400,7 +400,7 @@ virCPUGetHost(virArch arch,
|
||||
virReportError(VIR_ERR_INVALID_ARG,
|
||||
_("cannot set topology for CPU type '%s'"),
|
||||
virCPUTypeToString(type));
|
||||
goto error;
|
||||
return NULL;
|
||||
}
|
||||
cpu->type = type;
|
||||
break;
|
||||
@ -410,7 +410,7 @@ virCPUGetHost(virArch arch,
|
||||
virReportError(VIR_ERR_INVALID_ARG,
|
||||
_("unsupported CPU type: %s"),
|
||||
virCPUTypeToString(type));
|
||||
goto error;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (nodeInfo) {
|
||||
@ -424,9 +424,8 @@ virCPUGetHost(virArch arch,
|
||||
* filled in.
|
||||
*/
|
||||
if (driver->getHost) {
|
||||
if (driver->getHost(cpu, models) < 0 &&
|
||||
!nodeInfo)
|
||||
goto error;
|
||||
if (driver->getHost(cpu, models) < 0 && !nodeInfo)
|
||||
return NULL;
|
||||
} else if (nodeInfo) {
|
||||
VIR_DEBUG("cannot detect host CPU model for %s architecture",
|
||||
virArchToString(arch));
|
||||
@ -434,14 +433,10 @@ virCPUGetHost(virArch arch,
|
||||
virReportError(VIR_ERR_NO_SUPPORT,
|
||||
_("cannot detect host CPU model for %s architecture"),
|
||||
virArchToString(arch));
|
||||
goto error;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return cpu;
|
||||
|
||||
error:
|
||||
virCPUDefFree(cpu);
|
||||
return NULL;
|
||||
return g_steal_pointer(&cpu);
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user