1
0
mirror of https://gitlab.com/libvirt/libvirt.git synced 2025-03-07 17:28:15 +00:00

qemu_conf: Drop a pair of needless 'cleanup' labels

There are two 'cleanup' labels - one in
virQEMUDriverConfigHugeTLBFSInit() and the other in
virQEMUDriverConfigSetDefaults() that do nothing more than
return and integer value. No memory freeing or anything important
is done there. Drop them in favour of returning immediately.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
This commit is contained in:
Michal Privoznik 2019-09-09 17:24:22 +02:00
parent ebd63e3b47
commit 4ba7e5b4ed

View File

@ -402,18 +402,13 @@ virQEMUDriverConfigHugeTLBFSInit(virHugeTLBFSPtr hugetlbfs,
const char *path,
bool deflt)
{
int ret = -1;
if (VIR_STRDUP(hugetlbfs->mnt_dir, path) < 0)
goto cleanup;
if (virFileGetHugepageSize(path, &hugetlbfs->size) < 0)
goto cleanup;
if (VIR_STRDUP(hugetlbfs->mnt_dir, path) < 0 ||
virFileGetHugepageSize(path, &hugetlbfs->size) < 0) {
return -1;
}
hugetlbfs->deflt = deflt;
ret = 0;
cleanup:
return ret;
return 0;
}
@ -1172,16 +1167,15 @@ virQEMUDriverConfigValidate(virQEMUDriverConfigPtr cfg)
int
virQEMUDriverConfigSetDefaults(virQEMUDriverConfigPtr cfg)
{
int ret = -1;
#define SET_TLS_SECRET_UUID_DEFAULT(val) \
do { \
if (!cfg->val## TLSx509certdir && \
!cfg->val## TLSx509secretUUID && \
cfg->defaultTLSx509secretUUID) { \
if (VIR_STRDUP(cfg->val## TLSx509secretUUID, \
cfg->defaultTLSx509secretUUID) < 0) \
goto cleanup; \
cfg->defaultTLSx509secretUUID) < 0) { \
return -1; \
} \
} \
} while (0)
@ -1204,12 +1198,14 @@ virQEMUDriverConfigSetDefaults(virQEMUDriverConfigPtr cfg)
break; \
if (virFileExists(SYSCONFDIR "/pki/libvirt-"#val)) { \
if (VIR_STRDUP(cfg->val ## TLSx509certdir, \
SYSCONFDIR "/pki/libvirt-"#val) < 0) \
goto cleanup; \
SYSCONFDIR "/pki/libvirt-"#val) < 0) { \
return -1; \
} \
} else { \
if (VIR_STRDUP(cfg->val ## TLSx509certdir, \
cfg->defaultTLSx509certdir) < 0) \
goto cleanup; \
cfg->defaultTLSx509certdir) < 0) { \
return -1; \
} \
} \
} while (0)
@ -1234,9 +1230,7 @@ virQEMUDriverConfigSetDefaults(virQEMUDriverConfigPtr cfg)
#undef SET_TLS_VERIFY_DEFAULT
ret = 0;
cleanup:
return ret;
return 0;
}