]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
qemuDomainStorageAlias: Remove NULL checks from callers
authorPeter Krempa <pkrempa@redhat.com>
Mon, 17 Feb 2025 10:38:13 +0000 (11:38 +0100)
committerPeter Krempa <pkrempa@redhat.com>
Thu, 20 Feb 2025 14:15:39 +0000 (15:15 +0100)
'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>
src/qemu/qemu_driver.c
src/qemu/qemu_monitor_json.c

index aee66b2bc7a19ee17b679e0915677ec4279d1577..877fefaa38b9420416660dc054bfc29a09a33064 100644 (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 */
index 554572b13dd13c12838808accb52a1cd87e0adbf..74420b2ee7b7759a256ed9a62fc93f5334b8f8a3 100644 (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");