qemu with hax to log dma reads & writes jcs.org/2018/11/12/vfio

cmd646-ide: use qdev gpio rather than qemu_allocate_irqs()

This prevents the memory from qemu_allocate_irqs() from being leaked which
can in some cases be spotted by Coverity (CID 1421984).

Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Message-id: 20200324210519.2974-4-mark.cave-ayland@ilande.co.uk
Signed-off-by: John Snow <jsnow@redhat.com>

authored by

Mark Cave-Ayland and committed by
John Snow
cbf4c9ac 627a445a

+4 -5
+4 -5
hw/ide/cmd646.c
··· 249 249 static void pci_cmd646_ide_realize(PCIDevice *dev, Error **errp) 250 250 { 251 251 PCIIDEState *d = PCI_IDE(dev); 252 + DeviceState *ds = DEVICE(dev); 252 253 uint8_t *pci_conf = dev->config; 253 - qemu_irq *irq; 254 254 int i; 255 255 256 256 pci_conf[PCI_CLASS_PROG] = 0x8f; ··· 291 291 /* TODO: RST# value should be 0 */ 292 292 pci_conf[PCI_INTERRUPT_PIN] = 0x01; // interrupt on pin 1 293 293 294 - irq = qemu_allocate_irqs(cmd646_set_irq, d, 2); 294 + qdev_init_gpio_in(ds, cmd646_set_irq, 2); 295 295 for (i = 0; i < 2; i++) { 296 - ide_bus_new(&d->bus[i], sizeof(d->bus[i]), DEVICE(dev), i, 2); 297 - ide_init2(&d->bus[i], irq[i]); 296 + ide_bus_new(&d->bus[i], sizeof(d->bus[i]), ds, i, 2); 297 + ide_init2(&d->bus[i], qdev_get_gpio_in(ds, i)); 298 298 299 299 bmdma_init(&d->bus[i], &d->bmdma[i], d); 300 300 d->bmdma[i].bus = &d->bus[i]; 301 301 ide_register_restart_cb(&d->bus[i]); 302 302 } 303 - g_free(irq); 304 303 } 305 304 306 305 static void pci_cmd646_ide_exitfn(PCIDevice *dev)