pci_dev_realize() use the local error variable, which requires `error_setg()` API to allocate the error object at first.
Signed-off-by: Jim Shu <jim....@sifive.com> --- hw/vfio/pci.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/vfio/pci.c b/hw/vfio/pci.c index 0a99e55247..d994ad8bb9 100644 --- a/hw/vfio/pci.c +++ b/hw/vfio/pci.c @@ -3117,7 +3117,7 @@ static void vfio_realize(PCIDevice *pdev, Error **errp) if (!vbasedev->mdev && !pci_device_set_iommu_device(pdev, vbasedev->hiod, errp)) { - error_prepend(errp, "Failed to set iommu_device: "); + error_setg(errp, "Failed to set iommu_device: "); goto out_teardown; } -- 2.17.1