From 033b8d177e4512f0ba3af8ed46ee38a4251c7e1c 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 | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
index 41e9660ecd..348280d9be 100644
--- a/src/qemu/qemu_process.c
+++ b/src/qemu/qemu_process.c
@@ -7929,10 +7929,12 @@ 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;
 
  cleanup:
-- 
2.27.0

