[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 5/5] cmd646-ide: use qdev gpio rather than qemu_allocate_irqs()
From: |
John Snow |
Subject: |
[PULL 5/5] cmd646-ide: use qdev gpio rather than qemu_allocate_irqs() |
Date: |
Fri, 27 Mar 2020 16:15:01 -0400 |
From: Mark Cave-Ayland <address@hidden>
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 <address@hidden>
Message-id: address@hidden
Signed-off-by: John Snow <address@hidden>
---
hw/ide/cmd646.c | 9 ++++-----
1 file changed, 4 insertions(+), 5 deletions(-)
diff --git a/hw/ide/cmd646.c b/hw/ide/cmd646.c
index 699f25824d..c254631485 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)
--
2.21.1
- [PULL 0/5] Ide patches, John Snow, 2020/03/27
- [PULL 1/5] fdc/i8257: implement verify transfer mode, John Snow, 2020/03/27
- [PULL 2/5] hw/ide/sii3112: Use qdev gpio rather than qemu_allocate_irqs(), John Snow, 2020/03/27
- [PULL 3/5] via-ide: don't use PCI level for legacy IRQs, John Snow, 2020/03/27
- [PULL 4/5] via-ide: use qdev gpio rather than qemu_allocate_irqs(), John Snow, 2020/03/27
- [PULL 5/5] cmd646-ide: use qdev gpio rather than qemu_allocate_irqs(),
John Snow <=
- Re: [PULL 0/5] Ide patches, Peter Maydell, 2020/03/28