virDomainDefAddUSBController() does everything that the multiple lines
of code were doing.
---
src/qemu/qemu_parse_command.c | 8 +-------
1 file changed, 1 insertion(+), 7 deletions(-)
diff --git a/src/qemu/qemu_parse_command.c b/src/qemu/qemu_parse_command.c
index 7ce90f9..23b0159 100644
--- a/src/qemu/qemu_parse_command.c
+++ b/src/qemu/qemu_parse_command.c
@@ -2350,14 +2350,8 @@ qemuParseCommandLine(virCapsPtr caps,
WANT_VALUE();
/* ignore, generted on the fly */
} else if (STREQ(arg, "-usb")) {
- virDomainControllerDefPtr ctldef;
- ctldef = virDomainControllerDefNew(VIR_DOMAIN_CONTROLLER_TYPE_USB);
- if (!ctldef)
+ if (virDomainDefAddUSBController(def, -1, -1) < 0)
goto error;
- if (virDomainControllerInsert(def, ctldef) < 0) {
- virDomainControllerDefFree(ctldef);
- goto error;
- }
} else if (STREQ(arg, "-pidfile")) {
WANT_VALUE();
if (pidfile)
--
2.5.5