]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
qemuBlockGetBackingStoreString: Remove 'ret' variable
authorPeter Krempa <pkrempa@redhat.com>
Mon, 23 Mar 2020 14:29:56 +0000 (15:29 +0100)
committerPeter Krempa <pkrempa@redhat.com>
Tue, 24 Mar 2020 13:17:47 +0000 (14:17 +0100)
We can return the appropriate string directly.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
src/qemu/qemu_block.c

index d6cc999a43a6c0c509a0125710690af84c104eae..b7c3ba753096345c12740e31435a157887693393 100644 (file)
@@ -2043,13 +2043,10 @@ qemuBlockGetBackingStoreString(virStorageSourcePtr src,
     virJSONValuePtr props = NULL;
     g_autoptr(virURI) uri = NULL;
     g_autofree char *backingJSON = NULL;
-    char *ret = NULL;
 
     if (!src->sliceStorage) {
-        if (virStorageSourceIsLocalStorage(src)) {
-            ret = g_strdup(src->path);
-            return ret;
-        }
+        if (virStorageSourceIsLocalStorage(src))
+            return g_strdup(src->path);
 
         /* generate simplified URIs for the easy cases */
         if (actualType == VIR_STORAGE_TYPE_NETWORK &&
@@ -2068,10 +2065,7 @@ qemuBlockGetBackingStoreString(virStorageSourcePtr src,
                 if (!(uri = qemuBlockStorageSourceGetURI(src)))
                     return NULL;
 
-                if (!(ret = virURIFormat(uri)))
-                    return NULL;
-
-                return ret;
+                return virURIFormat(uri);
 
             case VIR_STORAGE_NET_PROTOCOL_SHEEPDOG:
             case VIR_STORAGE_NET_PROTOCOL_RBD:
@@ -2105,9 +2099,7 @@ qemuBlockGetBackingStoreString(virStorageSourcePtr src,
     if (!(backingJSON = virJSONValueToString(props, pretty)))
         return NULL;
 
-    ret = g_strdup_printf("json:%s", backingJSON);
-
-    return ret;
+    return g_strdup_printf("json:%s", backingJSON);
 }