]> xenbits.xensource.com Git - libvirt.git/commitdiff
qemuBlockDiskDetectNodes: just return when alias is null
authorYi Li <yili@winhong.com>
Thu, 18 Feb 2021 02:43:33 +0000 (10:43 +0800)
committerJán Tomko <jtomko@redhat.com>
Thu, 18 Feb 2021 07:35:08 +0000 (08:35 +0100)
Just return when alias is null and Remove the 'ret' variable.

Signed-off-by: Yi Li <yili@winhong.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
src/qemu/qemu_block.c

index 3d88e701b2f0447a6b2cc02c2a08df1bc7ea9b9c..0af3e56c9a7d91c4184d80a6b027f8de50c6f65d 100644 (file)
@@ -280,25 +280,22 @@ qemuBlockDiskDetectNodes(virDomainDiskDefPtr disk,
     qemuBlockNodeNameBackingChainDataPtr entry = NULL;
     virStorageSourcePtr src = disk->src;
     g_autofree char *alias = NULL;
-    int ret = -1;
 
     /* don't attempt the detection if the top level already has node names */
     if (src->nodeformat || src->nodestorage)
         return 0;
 
     if (!(alias = qemuAliasDiskDriveFromDisk(disk)))
-        goto cleanup;
+        return -1;
 
-    if (!(entry = virHashLookup(disktable, alias))) {
-        ret = 0;
-        goto cleanup;
-    }
+    if (!(entry = virHashLookup(disktable, alias)))
+        return 0;
 
     while (virStorageSourceIsBacking(src) && entry) {
         if (src->nodeformat || src->nodestorage) {
             if (STRNEQ_NULLABLE(src->nodeformat, entry->nodeformat) ||
                 STRNEQ_NULLABLE(src->nodestorage, entry->nodestorage))
-                goto cleanup;
+                goto error;
 
             break;
         } else {
@@ -310,13 +307,11 @@ qemuBlockDiskDetectNodes(virDomainDiskDefPtr disk,
         src = src->backingStore;
     }
 
-    ret = 0;
-
- cleanup:
-    if (ret < 0)
-        qemuBlockDiskClearDetectedNodes(disk);
+    return 0;
 
-    return ret;
+ error:
+    qemuBlockDiskClearDetectedNodes(disk);
+    return -1;
 }