From f083c24428a2f4d5106a9369dec0876f6143d270 Mon Sep 17 00:00:00 2001
From: Dawei Jiang <jiangdawei15@huawei.com>
Date: Mon, 8 Apr 2024 19:59:11 +0800
Subject: [PATCH] hotpatch: if hotpatch_path not in qemu.conf,the hotpatch
 doesn't antoload

Signed-off-by: Dawei Jiang <jiangdawei15@huawei.com>
---
 src/qemu/qemu_process.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
index 48d39ba97c..013c9eb847 100644
--- a/src/qemu/qemu_process.c
+++ b/src/qemu/qemu_process.c
@@ -7330,8 +7330,11 @@ qemuProcessLaunch(virConnectPtr conn,
         goto cleanup;
 
     /* Autoload hotpatch */
-    if ((autoLoadStatus = qemuDomainHotpatchAutoload(vm, cfg->hotpatchPath)) == NULL) {
-        VIR_WARN("Failed to autoload the hotpatch for %s.", vm->def->name);
+    if (cfg->hotpatchPath != NULL) {
+        autoLoadStatus = qemuDomainHotpatchAutoload(vm, cfg->hotpatchPath);
+        if (autoLoadStatus == NULL) {
+            VIR_WARN("Failed to autoload the hotpatch for %s.", vm->def->name);
+        }
     }
     ret = 0;
 
-- 
2.27.0

