Thanks, Björn.
Reviewed-by: Boris Fiuczynski <fiuczy(a)linux.ibm.com>
On 4/23/20 3:15 PM, Bjoern Walk wrote:
Now that qemuBuildVirtioOptionsStr can not fail anymore, remove its
return value and make it void.
Signed-off-by: Bjoern Walk <bwalk(a)linux.ibm.com>
---
src/qemu/qemu_command.c | 38 +++++++++++++-------------------------
1 file changed, 13 insertions(+), 25 deletions(-)
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index ca9d3f10..169a418f 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -586,12 +586,12 @@ qemuBuildVirtioDevStr(virBufferPtr buf,
return 0;
}
-static int
+static void
qemuBuildVirtioOptionsStr(virBufferPtr buf,
virDomainVirtioOptionsPtr virtio)
{
if (!virtio)
- return 0;
+ return;
if (virtio->iommu != VIR_TRISTATE_SWITCH_ABSENT) {
virBufferAsprintf(buf, ",iommu_platform=%s",
@@ -605,8 +605,6 @@ qemuBuildVirtioOptionsStr(virBufferPtr buf,
virBufferAsprintf(buf, ",packed=%s",
virTristateSwitchTypeToString(virtio->packed));
}
-
- return 0;
}
static int
@@ -2131,8 +2129,7 @@ qemuBuildDiskDeviceStr(const virDomainDef *def,
virBufferAsprintf(&opt, ",num-queues=%u", disk->queues);
}
- if (qemuBuildVirtioOptionsStr(&opt, disk->virtio) < 0)
- return NULL;
+ qemuBuildVirtioOptionsStr(&opt, disk->virtio);
if (qemuBuildDeviceAddressStr(&opt, def, &disk->info, qemuCaps) <
0)
return NULL;
@@ -2596,8 +2593,7 @@ qemuBuildVHostUserFsCommandLine(virCommandPtr cmd,
virBufferAsprintf(&opt, ",queue-size=%llu", fs->queue_size);
virBufferAddLit(&opt, ",tag=");
virQEMUBuildBufferEscapeComma(&opt, fs->dst);
- if (qemuBuildVirtioOptionsStr(&opt, fs->virtio) < 0)
- return -1;
+ qemuBuildVirtioOptionsStr(&opt, fs->virtio);
if (qemuBuildDeviceAddressStr(&opt, def, &fs->info, priv->qemuCaps)
< 0)
return -1;
@@ -2666,8 +2662,7 @@ qemuBuildFSDevStr(const virDomainDef *def,
virBufferAddLit(&opt, ",mount_tag=");
virQEMUBuildBufferEscapeComma(&opt, fs->dst);
- if (qemuBuildVirtioOptionsStr(&opt, fs->virtio) < 0)
- return NULL;
+ qemuBuildVirtioOptionsStr(&opt, fs->virtio);
if (qemuBuildDeviceAddressStr(&opt, def, &fs->info, qemuCaps) < 0)
return NULL;
@@ -2898,8 +2893,7 @@ qemuBuildControllerDevStr(const virDomainDef *domainDef,
def->iothread);
}
- if (qemuBuildVirtioOptionsStr(&buf, def->virtio) < 0)
- return -1;
+ qemuBuildVirtioOptionsStr(&buf, def->virtio);
break;
case VIR_DOMAIN_CONTROLLER_MODEL_SCSI_LSILOGIC:
virBufferAddLit(&buf, "lsi");
@@ -2945,8 +2939,7 @@ qemuBuildControllerDevStr(const virDomainDef *domainDef,
virBufferAsprintf(&buf, ",vectors=%d",
def->opts.vioserial.vectors);
}
- if (qemuBuildVirtioOptionsStr(&buf, def->virtio) < 0)
- return -1;
+ qemuBuildVirtioOptionsStr(&buf, def->virtio);
break;
case VIR_DOMAIN_CONTROLLER_TYPE_CCID:
@@ -3896,9 +3889,8 @@ qemuBuildNicDevStr(virDomainDefPtr def,
return NULL;
if (bootindex)
virBufferAsprintf(&buf, ",bootindex=%u", bootindex);
- if (usingVirtio &&
- qemuBuildVirtioOptionsStr(&buf, net->virtio) < 0)
- return NULL;
+ if (usingVirtio)
+ qemuBuildVirtioOptionsStr(&buf, net->virtio);
return virBufferContentAndReset(&buf);
}
@@ -4139,8 +4131,7 @@ qemuBuildMemballoonCommandLine(virCommandPtr cmd,
virTristateSwitchTypeToString(def->memballoon->autodeflate));
}
- if (qemuBuildVirtioOptionsStr(&buf, def->memballoon->virtio) < 0)
- return -1;
+ qemuBuildVirtioOptionsStr(&buf, def->memballoon->virtio);
if (qemuCommandAddExtDevice(cmd, &def->memballoon->info) < 0)
return -1;
@@ -4231,8 +4222,7 @@ qemuBuildVirtioInputDevStr(const virDomainDef *def,
if (qemuBuildDeviceAddressStr(&buf, def, &dev->info, qemuCaps) < 0)
return NULL;
- if (qemuBuildVirtioOptionsStr(&buf, dev->virtio) < 0)
- return NULL;
+ qemuBuildVirtioOptionsStr(&buf, dev->virtio);
return virBufferContentAndReset(&buf);
}
@@ -4542,8 +4532,7 @@ qemuBuildDeviceVideoStr(const virDomainDef *def,
if (qemuBuildDeviceAddressStr(&buf, def, &video->info, qemuCaps) <
0)
return NULL;
- if (qemuBuildVirtioOptionsStr(&buf, video->virtio) < 0)
- return NULL;
+ qemuBuildVirtioOptionsStr(&buf, video->virtio);
return virBufferContentAndReset(&buf);
}
@@ -5758,8 +5747,7 @@ qemuBuildRNGDevStr(const virDomainDef *def,
virBufferAddLit(&buf, ",period=1000");
}
- if (qemuBuildVirtioOptionsStr(&buf, dev->virtio) < 0)
- return NULL;
+ qemuBuildVirtioOptionsStr(&buf, dev->virtio);
if (qemuBuildDeviceAddressStr(&buf, def, &dev->info, qemuCaps) < 0)
return NULL;
--
Mit freundlichen Grüßen/Kind regards
Boris Fiuczynski
IBM Deutschland Research & Development GmbH
Vorsitzender des Aufsichtsrats: Gregor Pillen
Geschäftsführung: Dirk Wittkopp
Sitz der Gesellschaft: Böblingen
Registergericht: Amtsgericht Stuttgart, HRB 243294