summary refs log tree commit diff stats
path: root/hw/mem/memory-device.c
diff options
context:
space:
mode:
authorDavid Hildenbrand <david@redhat.com>2023-06-23 14:45:44 +0200
committerDavid Hildenbrand <david@redhat.com>2023-07-12 09:25:06 +0200
commit99d88de6eb577ff70cc1b1ed59f1a50f16038c2e (patch)
tree58e08ebad83afe25f85d678861d37c5e9bb0df42 /hw/mem/memory-device.c
parent887cba855bb6ff4775256f7968409281350b568c (diff)
downloadfocaccia-qemu-99d88de6eb577ff70cc1b1ed59f1a50f16038c2e.tar.gz
focaccia-qemu-99d88de6eb577ff70cc1b1ed59f1a50f16038c2e.zip
memory-device: Unify enabled vs. supported error messages
Let's unify the error messages, such that we can simply stop allocating
ms->device_memory if the size would be 0 (and there are no memory
devices ever).

The case of "not supported by the machine" should barely pop up either
way: if the machine doesn't support memory devices, it usually doesn't
call the pre_plug handler ...

Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Signed-off-by: David Hildenbrand <david@redhat.com>
Message-Id: <20230623124553.400585-2-david@redhat.com>
Signed-off-by: David Hildenbrand <david@redhat.com>
Diffstat (limited to 'hw/mem/memory-device.c')
-rw-r--r--hw/mem/memory-device.c13
1 files changed, 4 insertions, 9 deletions
diff --git a/hw/mem/memory-device.c b/hw/mem/memory-device.c
index 1636db9679..49f86ec8a8 100644
--- a/hw/mem/memory-device.c
+++ b/hw/mem/memory-device.c
@@ -104,15 +104,10 @@ static uint64_t memory_device_get_free_addr(MachineState *ms,
     GSList *list = NULL, *item;
     Range as, new = range_empty;
 
-    if (!ms->device_memory) {
-        error_setg(errp, "memory devices (e.g. for memory hotplug) are not "
-                         "supported by the machine");
-        return 0;
-    }
-
-    if (!memory_region_size(&ms->device_memory->mr)) {
-        error_setg(errp, "memory devices (e.g. for memory hotplug) are not "
-                         "enabled, please specify the maxmem option");
+    if (!ms->device_memory || !memory_region_size(&ms->device_memory->mr)) {
+        error_setg(errp, "the configuration is not prepared for memory devices"
+                         " (e.g., for memory hotplug), consider specifying the"
+                         " maxmem option");
         return 0;
     }
     range_init_nofail(&as, ms->device_memory->base,