代码拉取完成,页面将自动刷新
同步操作将从 src-openEuler/qemu 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
From 32855e315c3050f09388f1335c0869bba065fbae Mon Sep 17 00:00:00 2001
From: yangdepei <yangdepei@hygon.cn>
Date: Fri, 27 Sep 2024 17:08:08 +0800
Subject: [PATCH] hw/vfio/hct: qemu startup terminate once error happened in
hct
Signed-off-by: yangdepei <yangdepei@hygon.cn>
---
hw/vfio/hct.c | 19 ++++++++++++++-----
1 file changed, 14 insertions(+), 5 deletions(-)
diff --git a/hw/vfio/hct.c b/hw/vfio/hct.c
index 9374e95e85..7fd3977182 100644
--- a/hw/vfio/hct.c
+++ b/hw/vfio/hct.c
@@ -136,7 +136,9 @@ static const MemoryRegionOps hct_mmio_ops = {
static void vfio_hct_detach_device(HCTDevState *state)
{
vfio_detach_device(&state->vdev);
- g_free(state->vdev.name);
+
+ if (state->vdev.name)
+ g_free(state->vdev.name);
}
static void vfio_hct_exit(PCIDevice *dev)
@@ -413,7 +415,6 @@ static int hct_data_init(HCTDevState *state)
int ret;
if (hct_data.init == 0) {
-
hct_data.hct_fd = qemu_open_old(HCT_SHARE_DEV, O_RDWR);
if (hct_data.hct_fd < 0) {
error_report("fail to open %s, errno %d.", HCT_SHARE_DEV, errno);
@@ -465,7 +466,6 @@ static void vfio_hct_realize(PCIDevice *pci_dev, Error **errp)
{
int ret;
char *mdevid;
- Error *err = NULL;
HCTDevState *state = PCI_HCT_DEV(pci_dev);
/* parsing mdev device name from startup scripts */
@@ -475,14 +475,18 @@ static void vfio_hct_realize(PCIDevice *pci_dev, Error **errp)
ret = hct_data_init(state);
if (ret < 0) {
g_free(state->vdev.name);
+ state->vdev.name = NULL;
+ error_setg(errp, "hct data init failed");
goto out;
}
ret = vfio_attach_device(state->vdev.name, &state->vdev,
- pci_device_iommu_address_space(pci_dev), &err);
+ pci_device_iommu_address_space(pci_dev), errp);
if (ret) {
- error_report("attach device failed, name = %s", state->vdev.name);
+ g_free(state->vdev.name);
+ state->vdev.name = NULL;
+ error_setg(errp, "attach device failed, name = %s", state->vdev.name);
goto data_uninit_out;
}
@@ -491,7 +495,12 @@ static void vfio_hct_realize(PCIDevice *pci_dev, Error **errp)
ret = vfio_hct_region_mmap(state);
if (ret < 0)
+ {
+ g_free(state->vdev.name);
+ state->vdev.name = NULL;
+ error_setg(errp, "region mmap failed, name = %s", state->vdev.name);
goto detach_device_out;
+ }
return;
--
2.41.0.windows.1
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。