[PATCH 14/22] util: Remove NONNULL(1) for virHostdevPrepareDomainDevices

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Since the code checks 'mgr == NULL' anyway, no need for the prototype
to have the NONNULL arg check.  Also add an error message to indicate what
the failure is so that there isn't a failed for some reason error.

Signed-off-by: John Ferlan <jferlan@xxxxxxxxxx>
---
 src/util/virhostdev.c | 5 ++++-
 src/util/virhostdev.h | 2 +-
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/src/util/virhostdev.c b/src/util/virhostdev.c
index fc0ebcb..a75d108 100644
--- a/src/util/virhostdev.c
+++ b/src/util/virhostdev.c
@@ -1873,8 +1873,11 @@ virHostdevPrepareDomainDevices(virHostdevManagerPtr mgr,
     if (!def->nhostdevs)
         return 0;
 
-    if (mgr == NULL)
+    if (!mgr) {
+        virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+                       _("no host device manager defined"));
         return -1;
+    }
 
     if (flags & VIR_HOSTDEV_SP_PCI) {
         if (virHostdevPreparePCIDevices(mgr, driver,
diff --git a/src/util/virhostdev.h b/src/util/virhostdev.h
index 43ba705..7ee0b43 100644
--- a/src/util/virhostdev.h
+++ b/src/util/virhostdev.h
@@ -157,7 +157,7 @@ virHostdevPrepareDomainDevices(virHostdevManagerPtr mgr,
                                const char *driver,
                                virDomainDefPtr def,
                                unsigned int flags)
-    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3);
+    ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3);
 void
 virHostdevReAttachDomainDevices(virHostdevManagerPtr mgr,
                                 const char *driver,
-- 
2.9.3

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]
  Powered by Linux