aboutsummaryrefslogtreecommitdiff
path: root/hw/ide
diff options
context:
space:
mode:
authorMark Cave-Ayland <mark.cave-ayland@ilande.co.uk>2020-03-24 21:05:19 +0000
committerJohn Snow <jsnow@redhat.com>2020-03-27 14:30:08 -0400
commitcbf4c9ac9c000f7caf1bfee031041b62d2b000c8 (patch)
treee6969b086cf8c7b58056c6dc694e8c4c79e6d74a /hw/ide
parent627a445ae0f0942a4cb95097204c7879722ce263 (diff)
downloadqemu-cbf4c9ac9c000f7caf1bfee031041b62d2b000c8.zip
qemu-cbf4c9ac9c000f7caf1bfee031041b62d2b000c8.tar.gz
qemu-cbf4c9ac9c000f7caf1bfee031041b62d2b000c8.tar.bz2
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>
Diffstat (limited to 'hw/ide')
-rw-r--r--hw/ide/cmd646.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/hw/ide/cmd646.c b/hw/ide/cmd646.c
index 699f258..c254631 100644
--- a/hw/ide/cmd646.c
+++ b/hw/ide/cmd646.c
@@ -249,8 +249,8 @@ static void cmd646_pci_config_write(PCIDevice *d, uint32_t addr, uint32_t val,
static void pci_cmd646_ide_realize(PCIDevice *dev, Error **errp)
{
PCIIDEState *d = PCI_IDE(dev);
+ DeviceState *ds = DEVICE(dev);
uint8_t *pci_conf = dev->config;
- qemu_irq *irq;
int i;
pci_conf[PCI_CLASS_PROG] = 0x8f;
@@ -291,16 +291,15 @@ static void pci_cmd646_ide_realize(PCIDevice *dev, Error **errp)
/* TODO: RST# value should be 0 */
pci_conf[PCI_INTERRUPT_PIN] = 0x01; // interrupt on pin 1
- irq = qemu_allocate_irqs(cmd646_set_irq, d, 2);
+ qdev_init_gpio_in(ds, cmd646_set_irq, 2);
for (i = 0; i < 2; i++) {
- ide_bus_new(&d->bus[i], sizeof(d->bus[i]), DEVICE(dev), i, 2);
- ide_init2(&d->bus[i], irq[i]);
+ ide_bus_new(&d->bus[i], sizeof(d->bus[i]), ds, i, 2);
+ ide_init2(&d->bus[i], qdev_get_gpio_in(ds, i));
bmdma_init(&d->bus[i], &d->bmdma[i], d);
d->bmdma[i].bus = &d->bus[i];
ide_register_restart_cb(&d->bus[i]);
}
- g_free(irq);
}
static void pci_cmd646_ide_exitfn(PCIDevice *dev)