]> xenbits.xensource.com Git - libvirt.git/commitdiff
conf: node_device: Fix build with clang
authorPeter Krempa <pkrempa@redhat.com>
Thu, 20 May 2021 10:17:09 +0000 (12:17 +0200)
committerPeter Krempa <pkrempa@redhat.com>
Thu, 20 May 2021 10:17:09 +0000 (12:17 +0200)
Clang complains:

  ../libvirt/src/conf/node_device_conf.c:1945:74: error: result of comparison of unsigned enum expression < 0 is always false [-Werror,-Wtautological-unsigned-enum-zero-compare]
        if ((mdev->start = virNodeDevMdevStartTypeFromString(starttype)) < 0) {

Fixes: 42a55854993
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
src/conf/node_device_conf.c

index 4e2b37c61238bf8fae2e4b078f58a06516c83661..5598d420fe524a00ca232cd4b1c2597412a8d2bf 100644 (file)
@@ -1942,11 +1942,14 @@ virNodeDevCapMdevParseXML(xmlXPathContextPtr ctxt,
     }
 
     if ((starttype = virXPathString("string(./start[1]/@type)", ctxt))) {
-        if ((mdev->start = virNodeDevMdevStartTypeFromString(starttype)) < 0) {
+        int tmp;
+        if ((tmp = virNodeDevMdevStartTypeFromString(starttype)) < 0) {
             virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
                            _("unknown mdev start type '%s' for '%s'"), starttype, def->name);
             return -1;
         }
+
+        mdev->start = tmp;
     } else {
         mdev->start = VIR_NODE_DEV_MDEV_START_MANUAL;
     }