Hello Jim,
On 9/12/24 07:17, Jim Shu wrote:
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)) {
'errp' will be set by pci_device_set_iommu_device() in case of
failure and, in this case, calling error_prepend() is a valid
thing to do. I think we are fine.
Thanks,
C.
- error_prepend(errp, "Failed to set iommu_device: ");
+ error_setg(errp, "Failed to set iommu_device: ");
goto out_teardown;
}