@@ -1168,7 +1168,7 @@ void ahci_init(AHCIState *s, DeviceState *qdev, int ports)
int i;
s->ports = ports;
- s->dev = g_malloc0(sizeof(AHCIDevice) * ports);
+ memset(s->dev, 0, sizeof(AHCIDevice) * ports);
ahci_reg_init(s);
/* XXX BAR size should be 1k, but that breaks, so bump it to 4k for now */
memory_region_init_io(&s->mem, &ahci_mem_ops, s, "ahci", AHCI_MEM_BAR_SIZE);
@@ -1194,7 +1194,6 @@ void ahci_uninit(AHCIState *s)
{
memory_region_destroy(&s->mem);
memory_region_destroy(&s->idp);
- g_free(s->dev);
}
void ahci_reset(void *opaque)
@@ -291,7 +291,7 @@ struct AHCIDevice {
};
typedef struct AHCIState {
- AHCIDevice *dev;
+ AHCIDevice dev[AHCI_MAX_PORTS];
AHCIControlRegs control_regs;
MemoryRegion mem;
MemoryRegion idp; /* Index-Data Pair I/O port space */
It seems, VMState cannot handle a dynamically allocated array of structs at this time. Change AHCIState to use an AHCIDevice array of size AHCI_MAX_PORTS. Of those 32, only 6 are being used for ich9. Signed-off-by: Andreas Färber <afaerber@suse.de> Cc: Juan Quintela <quintela@redhat.com> Cc: Kevin Wolf <kwolf@redhat.com> Cc: Alexander Graf <agraf@suse.de> --- hw/ide/ahci.c | 3 +-- hw/ide/ahci.h | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-)