aboutsummaryrefslogtreecommitdiff
path: root/hw/ide/via.c
diff options
context:
space:
mode:
authorMark Cave-Ayland <mark.cave-ayland@ilande.co.uk>2020-03-24 21:05:18 +0000
committerJohn Snow <jsnow@redhat.com>2020-03-27 14:30:08 -0400
commit627a445ae0f0942a4cb95097204c7879722ce263 (patch)
treedba9a59f998821fe88744cf2bf220d415cb9f9da /hw/ide/via.c
parentb93858756982ec76a36d4140765efad5ce0fbd5f (diff)
downloadqemu-627a445ae0f0942a4cb95097204c7879722ce263.zip
qemu-627a445ae0f0942a4cb95097204c7879722ce263.tar.gz
qemu-627a445ae0f0942a4cb95097204c7879722ce263.tar.bz2
via-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-3-mark.cave-ayland@ilande.co.uk Signed-off-by: John Snow <jsnow@redhat.com>
Diffstat (limited to 'hw/ide/via.c')
-rw-r--r--hw/ide/via.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/hw/ide/via.c b/hw/ide/via.c
index 2a55b7f..be09912 100644
--- a/hw/ide/via.c
+++ b/hw/ide/via.c
@@ -160,6 +160,7 @@ static void via_ide_reset(DeviceState *dev)
static void via_ide_realize(PCIDevice *dev, Error **errp)
{
PCIIDEState *d = PCI_IDE(dev);
+ DeviceState *ds = DEVICE(dev);
uint8_t *pci_conf = dev->config;
int i;
@@ -187,9 +188,10 @@ static void via_ide_realize(PCIDevice *dev, Error **errp)
bmdma_setup_bar(d);
pci_register_bar(dev, 4, PCI_BASE_ADDRESS_SPACE_IO, &d->bmdma_bar);
+ qdev_init_gpio_in(ds, via_ide_set_irq, 2);
for (i = 0; i < 2; i++) {
- ide_bus_new(&d->bus[i], sizeof(d->bus[i]), DEVICE(d), i, 2);
- ide_init2(&d->bus[i], qemu_allocate_irq(via_ide_set_irq, d, 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];