]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
storage: Clean up return value checking
authorJohn Ferlan <jferlan@redhat.com>
Fri, 13 Jan 2017 12:34:03 +0000 (07:34 -0500)
committerJohn Ferlan <jferlan@redhat.com>
Sat, 14 Jan 2017 15:13:05 +0000 (10:13 -0500)
Rather than special casing the VIR_STORAGE_BLKID_PROBE_UNKNOWN after
calling virStorageBackendBLKIDFindPart, just allow the switch statement
handle setting ret = -2.

src/storage/storage_backend.c

index cf7e68a5cd764555260577191ded80d323828686..79482e62212e36add5e77903d1c976065111094b 100644 (file)
@@ -2777,10 +2777,6 @@ virStorageBackendBLKIDFindEmpty(const char *device,
         rc == VIR_STORAGE_BLKID_PROBE_UNKNOWN) {
 
         rc = virStorageBackendBLKIDFindPart(probe, device, format);
-        if (rc == VIR_STORAGE_BLKID_PROBE_UNKNOWN) {
-            ret = -2;
-            goto cleanup;
-        }
     }
 
     switch (rc) {
@@ -2799,10 +2795,7 @@ virStorageBackendBLKIDFindEmpty(const char *device,
         break;
 
     case VIR_STORAGE_BLKID_PROBE_UNKNOWN:
-        virReportError(VIR_ERR_STORAGE_PROBE_FAILED,
-                       _("Not capable of probing for format type '%s', "
-                         "requires build --overwrite"),
-                       format);
+        ret = -2;
         break;
 
     case VIR_STORAGE_BLKID_PROBE_MATCH:
@@ -2829,7 +2822,6 @@ virStorageBackendBLKIDFindEmpty(const char *device,
         ret = -1;
     }
 
- cleanup:
     blkid_free_probe(probe);
 
     return ret;