Message ID | 20210719200827.1507276-3-danielhb413@gmail.com |
---|---|
State | New |
Headers | show |
Series | DEVICE_UNPLUG_ERROR QAPI event | expand |
Daniel Henrique Barboza <danielhb413@gmail.com> writes: > As done in hw/acpi/memory_hotplug.c, avoid sending > qapi_event_send_mem_unplug_error() if dev->id is NULL. > > Suggested-by: Markus Armbruster <armbru@redhat.com> > Reviewed-by: Greg Kurz <groug@kaod.org> > Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com> > --- > hw/ppc/spapr.c | 8 +++++--- > 1 file changed, 5 insertions(+), 3 deletions(-) > > diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c > index 81699d4f8b..1611d7ab05 100644 > --- a/hw/ppc/spapr.c > +++ b/hw/ppc/spapr.c > @@ -3688,9 +3688,11 @@ void spapr_memory_unplug_rollback(SpaprMachineState *spapr, DeviceState *dev) > * Tell QAPI that something happened and the memory > * hotunplug wasn't successful. > */ > - 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); > + if (dev->id) { > + 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); > + } > } > > /* Callback to be called during DRC release. */ My review of PATCH 1 applies.
diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c index 81699d4f8b..1611d7ab05 100644 --- a/hw/ppc/spapr.c +++ b/hw/ppc/spapr.c @@ -3688,9 +3688,11 @@ void spapr_memory_unplug_rollback(SpaprMachineState *spapr, DeviceState *dev) * Tell QAPI that something happened and the memory * hotunplug wasn't successful. */ - 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); + if (dev->id) { + 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); + } } /* Callback to be called during DRC release. */