1
0
mirror of https://gitlab.com/libvirt/libvirt.git synced 2025-03-20 06:50:22 +03:00

qemuDomainStorageAlias: Remove NULL checks from callers

'qemuDomainStorageAlias' always returns non-NULL pointer if it gets a
non-NULL string on input. Remove unneeded checks from callers.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
Peter Krempa 2025-02-17 11:38:13 +01:00
parent f5e4c2a508
commit a4b5ef9c87
2 changed files with 4 additions and 6 deletions

View File

@ -17415,9 +17415,8 @@ qemuDomainGetStatsBlockExportDisk(virDomainDiskDef *disk,
backendstoragealias = qemuBlockStorageSourceGetStorageNodename(n);
} else {
/* alias may be NULL if the VM is not running */
if (disk->info.alias &&
!(alias = qemuDomainStorageAlias(disk->info.alias, n->id)))
return -1;
if (disk->info.alias)
alias = qemuDomainStorageAlias(disk->info.alias, n->id);
/* for 'sd' disks we won't be displaying stats for the backing chain
* as we don't update the stats correctly */

View File

@ -2332,9 +2332,8 @@ qemuMonitorJSONGetOneBlockStatsInfo(virJSONValue *dev,
g_autofree char *devicename = NULL;
virJSONValue *backing;
if (dev_name &&
!(devicename = qemuDomainStorageAlias(dev_name, depth)))
return -1;
if (dev_name)
devicename = qemuDomainStorageAlias(dev_name, depth);
qdevname = virJSONValueObjectGetString(dev, "qdev");
nodename = virJSONValueObjectGetString(dev, "node-name");