From: Daniel Henrique Barboza <danielhb...@gmail.com>

As done in hw/acpi/memory_hotplug.c, pass an empty string if dev->id
is NULL to qapi_event_send_mem_unplug_error() to avoid relying on
a behavior that can be changed in the future.

Suggested-by: Markus Armbruster <arm...@redhat.com>
Reviewed-by: Greg Kurz <gr...@kaod.org>
Reviewed-by: David Gibson <da...@gibson.dropbear.id.au>
Reviewed-by: Markus Armbruster <arm...@redhat.com>
Signed-off-by: Daniel Henrique Barboza <danielhb...@gmail.com>
Message-Id: <20210907004755.424931-3-danielhb...@gmail.com>
Signed-off-by: David Gibson <da...@gibson.dropbear.id.au>
---
 hw/ppc/spapr.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c
index d39fd4e644..ac11c8a728 100644
--- a/hw/ppc/spapr.c
+++ b/hw/ppc/spapr.c
@@ -3690,7 +3690,7 @@ void spapr_memory_unplug_rollback(SpaprMachineState 
*spapr, DeviceState *dev)
      */
     qapi_error = g_strdup_printf("Memory hotunplug rejected by the guest "
                                  "for device %s", dev->id);
-    qapi_event_send_mem_unplug_error(dev->id, qapi_error);
+    qapi_event_send_mem_unplug_error(dev->id ? : "", qapi_error);
 }
 
 /* Callback to be called during DRC release. */
-- 
2.31.1


Reply via email to