[libvirt PATCH 23/24] tests: vir: remove pointless labels

Ján Tomko jtomko at redhat.com
Thu Sep 9 14:28:02 UTC 2021


On a Monday in 2021, Laine Stump wrote:
>On 9/4/21 4:44 PM, Ján Tomko wrote:
>
>>@@ -319,9 +308,9 @@ testFileIsSharedFSType(const void *opaque G_GNUC_UNUSED)
>>      return EXIT_AM_SKIP;
>>  #else
>>      const struct testFileIsSharedFSType *data = opaque;
>>+    int ret = -1;
>>      g_autofree char *mtabFile = NULL;
>>      bool actual;
>>-    int ret = -1;
>
>unrelated (well, only peripherally related) code movement.
>
>[...]
>
>
>>@@ -199,15 +195,15 @@ testVirPCIDeviceReattach(const void *opaque G_GNUC_UNUSED)
>>      for (i = 0; i < nDev; i++) {
>>          if (virPCIDeviceReattach(dev[i], activeDevs, inactiveDevs) < 0)
>>-            goto cleanup;
>>+            return -1;
>>          CHECK_LIST_COUNT(activeDevs, 0);
>>          CHECK_LIST_COUNT(inactiveDevs, nDev - i - 1);
>>      }
>>-    ret = 0;
>>+    return 0;
>>   cleanup:
>>-    return ret;
>>+    return -1;
>>  }
>
>
>Oops. You forgot one! cleanup is no longer referenced, but you didn't 
>remove it (or the dead code "return -1;" following it)
>

'cleanup' is still referenced inside the 'CHECK_LIST_COUNT' macro,
which is also used by testVirPCIDeviceReset and testVirPCIDeviceDetach.

On second thought, mixing returns with cleanups does not seem like
a good idea and I will drop this partial conversion before pushing.

Jano
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20210909/f2705f41/attachment-0001.sig>


More information about the libvir-list mailing list