[PATCH 01/27] conf: make virPCIDeviceAddressFormat void

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

 



Only one of the three callers of virPCIDeviceAddressFormat correctly
handles an error return status. Fortunately it can't fail so can be
made void.

Signed-off-by: Daniel P. Berrangé <berrange@xxxxxxxxxx>
---
 src/conf/device_conf.c          | 3 +--
 src/conf/device_conf.h          | 6 +++---
 src/conf/domain_conf.c          | 6 ++----
 src/conf/network_conf.c         | 7 +++----
 src/conf/storage_adapter_conf.c | 4 ++--
 5 files changed, 11 insertions(+), 15 deletions(-)

diff --git a/src/conf/device_conf.c b/src/conf/device_conf.c
index 32628c6448..cd994057c5 100644
--- a/src/conf/device_conf.c
+++ b/src/conf/device_conf.c
@@ -308,7 +308,7 @@ virPCIDeviceAddressParseXML(xmlNodePtr node,
     return ret;
 }
 
-int
+void
 virPCIDeviceAddressFormat(virBufferPtr buf,
                           virPCIDeviceAddress addr,
                           bool includeTypeInAddr)
@@ -320,7 +320,6 @@ virPCIDeviceAddressFormat(virBufferPtr buf,
                       addr.bus,
                       addr.slot,
                       addr.function);
-    return 0;
 }
 
 bool
diff --git a/src/conf/device_conf.h b/src/conf/device_conf.h
index 56745707d9..7a3455f99f 100644
--- a/src/conf/device_conf.h
+++ b/src/conf/device_conf.h
@@ -202,9 +202,9 @@ bool virDeviceInfoPCIAddressExtensionIsPresent(const virDomainDeviceInfo *info);
 int virPCIDeviceAddressParseXML(xmlNodePtr node,
                                 virPCIDeviceAddressPtr addr);
 
-int virPCIDeviceAddressFormat(virBufferPtr buf,
-                              virPCIDeviceAddress addr,
-                              bool includeTypeInAddr);
+void virPCIDeviceAddressFormat(virBufferPtr buf,
+                               virPCIDeviceAddress addr,
+                               bool includeTypeInAddr);
 
 bool virDomainDeviceCCWAddressIsValid(virDomainDeviceCCWAddressPtr addr);
 int virDomainDeviceCCWAddressParseXML(xmlNodePtr node,
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index d8dfd1656f..706ee361ff 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -24809,10 +24809,8 @@ virDomainHostdevDefFormatSubsys(virBufferPtr buf,
         }
         break;
     case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_PCI:
-        if (virPCIDeviceAddressFormat(buf, pcisrc->addr,
-                                      includeTypeInAddr) != 0)
-            virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
-                           _("PCI address Formatting failed"));
+        virPCIDeviceAddressFormat(buf, pcisrc->addr,
+                                  includeTypeInAddr);
 
         if ((flags & VIR_DOMAIN_DEF_FORMAT_PCI_ORIG_STATES) &&
             (def->origstates.states.pci.unbind_from_stub ||
diff --git a/src/conf/network_conf.c b/src/conf/network_conf.c
index e035d8aba7..3e2d6dc756 100644
--- a/src/conf/network_conf.c
+++ b/src/conf/network_conf.c
@@ -2471,10 +2471,9 @@ virNetworkDefFormatBuf(virBufferPtr buf,
                     virBufferAddLit(buf, "/>\n");
                 } else {
                     if (def->forward.ifs[i].type ==  VIR_NETWORK_FORWARD_HOSTDEV_DEVICE_PCI) {
-                        if (virPCIDeviceAddressFormat(buf,
-                                                      def->forward.ifs[i].device.pci,
-                                                      true) < 0)
-                            goto error;
+                        virPCIDeviceAddressFormat(buf,
+                                                  def->forward.ifs[i].device.pci,
+                                                  true);
                     }
                 }
             }
diff --git a/src/conf/storage_adapter_conf.c b/src/conf/storage_adapter_conf.c
index f333ae16ff..65d664b89b 100644
--- a/src/conf/storage_adapter_conf.c
+++ b/src/conf/storage_adapter_conf.c
@@ -325,8 +325,8 @@ virStorageAdapterFormatSCSIHost(virBufferPtr buf,
         virBufferAsprintf(buf, "<parentaddr unique_id='%d'>\n",
                           scsi_host->unique_id);
         virBufferAdjustIndent(buf, 2);
-        ignore_value(virPCIDeviceAddressFormat(buf, scsi_host->parentaddr,
-                                               false));
+        virPCIDeviceAddressFormat(buf, scsi_host->parentaddr,
+                                  false);
         virBufferAdjustIndent(buf, -2);
         virBufferAddLit(buf, "</parentaddr>\n");
         virBufferAdjustIndent(buf, -2);
-- 
2.19.2

--
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