From: John Snow <jsnow@redhat.com>
To: Peter Maydell <peter.maydell@linaro.org>, qemu-devel@nongnu.org
Cc: "Michael S. Tsirkin" <mst@redhat.com>,
"Mark Cave-Ayland" <mark.cave-ayland@ilande.co.uk>,
qemu-block@nongnu.org, "Helge Deller" <deller@gmx.de>,
"Hervé Poussineau" <hpoussin@reactos.org>,
"Aleksandar Rikalo" <aleksandar.rikalo@rt-rk.com>,
"David Gibson" <david@gibson.dropbear.id.au>,
"Philippe Mathieu-Daudé" <philmd@redhat.com>,
"Artyom Tarasenko" <atar4qemu@gmail.com>,
"Laurent Vivier" <lvivier@redhat.com>,
"Thomas Huth" <thuth@redhat.com>,
"Eduardo Habkost" <ehabkost@redhat.com>,
"John Snow" <jsnow@redhat.com>,
"Richard Henderson" <rth@twiddle.net>,
"Kevin Wolf" <kwolf@redhat.com>, "Max Reitz" <mreitz@redhat.com>,
qemu-ppc@nongnu.org,
"Aleksandar Markovic" <amarkovic@wavecomp.com>,
"Paolo Bonzini" <pbonzini@redhat.com>,
"Aurelien Jarno" <aurelien@aurel32.net>
Subject: [PULL 5/5] cmd646-ide: use qdev gpio rather than qemu_allocate_irqs()
Date: Fri, 27 Mar 2020 16:15:01 -0400 [thread overview]
Message-ID: <20200327201501.1417-6-jsnow@redhat.com> (raw)
In-Reply-To: <20200327201501.1417-1-jsnow@redhat.com>
From: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
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>
---
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
next prev parent reply other threads:[~2020-03-27 20:22 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-03-27 20:14 [PULL 0/5] Ide patches John Snow
2020-03-27 20:14 ` [PULL 1/5] fdc/i8257: implement verify transfer mode John Snow
2020-03-27 20:14 ` [PULL 2/5] hw/ide/sii3112: Use qdev gpio rather than qemu_allocate_irqs() John Snow
2020-03-27 20:14 ` [PULL 3/5] via-ide: don't use PCI level for legacy IRQs John Snow
2020-03-27 20:15 ` [PULL 4/5] via-ide: use qdev gpio rather than qemu_allocate_irqs() John Snow
2020-03-27 20:15 ` John Snow [this message]
2020-03-28 9:38 ` [PULL 0/5] Ide patches Peter Maydell
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200327201501.1417-6-jsnow@redhat.com \
--to=jsnow@redhat.com \
--cc=aleksandar.rikalo@rt-rk.com \
--cc=amarkovic@wavecomp.com \
--cc=atar4qemu@gmail.com \
--cc=aurelien@aurel32.net \
--cc=david@gibson.dropbear.id.au \
--cc=deller@gmx.de \
--cc=ehabkost@redhat.com \
--cc=hpoussin@reactos.org \
--cc=kwolf@redhat.com \
--cc=lvivier@redhat.com \
--cc=mark.cave-ayland@ilande.co.uk \
--cc=mreitz@redhat.com \
--cc=mst@redhat.com \
--cc=pbonzini@redhat.com \
--cc=peter.maydell@linaro.org \
--cc=philmd@redhat.com \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=qemu-ppc@nongnu.org \
--cc=rth@twiddle.net \
--cc=thuth@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).