[libvirt PATCH 09/10] virDomainDeviceUSBAddressParseXML: Use virXMLProp*

Tim Wiederhake twiederh at redhat.com
Fri Apr 16 12:20:59 UTC 2021


Signed-off-by: Tim Wiederhake <twiederh at redhat.com>
---
 src/conf/device_conf.c | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/src/conf/device_conf.c b/src/conf/device_conf.c
index f7bf2de6f1..1ce31e9234 100644
--- a/src/conf/device_conf.c
+++ b/src/conf/device_conf.c
@@ -403,19 +403,16 @@ virDomainDeviceUSBAddressParseXML(xmlNodePtr node,
                                   virDomainDeviceUSBAddress *addr)
 {
     g_autofree char *port = virXMLPropString(node, "port");
-    g_autofree char *bus = virXMLPropString(node, "bus");
 
     memset(addr, 0, sizeof(*addr));
 
     if (port && virDomainDeviceUSBAddressParsePort(addr, port) < 0)
         return -1;
 
-    if (bus &&
-        virStrToLong_uip(bus, NULL, 10, &addr->bus) < 0) {
-        virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
-                       _("Cannot parse <address> 'bus' attribute"));
+    if (virXMLPropUInt(node, "bus", 10, VIR_XML_PROP_OPTIONAL,
+                       &addr->bus) < 0)
         return -1;
-    }
+
     return 0;
 }
 
-- 
2.26.2




More information about the libvir-list mailing list