From nobody Fri Apr 26 16:20:55 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1585084148; cv=none; d=zohomail.com; s=zohoarc; b=lUn+/Dc1B3mXjHHpkwuXreqxsKE+CglLpX+E4Y9dLCsLt2aD8a/lqpS6aMQeTnopbKTo/smik4p11DKjZy3cTht5kaT1y0xijdCGG0ayzhDrvSIpOHNTPOP6iC43Dz53iLdv4P1k6cngp5ZNSYXekF51h4vuTRZxOwEhsKAoVb4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1585084148; h=Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=+K73+Nk74zuAdZ+ygqwJJ0iQSbtvsLQ6wZGrr7y0bN0=; b=BdhZXQrhREQrRqgL+ravKqhQY6Jky9opZn7XmftQO1EmAiElUkKZEwcJJna7Ig6fxBROe9XKfzAOluFPsoV+jrv1faGyg7GUe2ZfrHvaSJfb/5z1xn9qzIr6A0+QcN3kSRPhITxo+6Ju/WanpdhD4WXMkNrHhKfvjwfKmaM7rcA= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1585084148396816.3057346380251; Tue, 24 Mar 2020 14:09:08 -0700 (PDT) Received: from localhost ([::1]:55050 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jGqnL-00047Q-5O for importer@patchew.org; Tue, 24 Mar 2020 17:09:07 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:34070) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jGqk5-0007FW-96 for qemu-devel@nongnu.org; Tue, 24 Mar 2020 17:05:46 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jGqk4-0005V8-9g for qemu-devel@nongnu.org; Tue, 24 Mar 2020 17:05:45 -0400 Received: from mail.ilande.co.uk ([2001:41c9:1:41f::167]:48386 helo=mail.default.ilande.uk0.bigv.io) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1jGqk4-0005US-3n; Tue, 24 Mar 2020 17:05:44 -0400 Received: from host86-130-37-163.range86-130.btcentralplus.com ([86.130.37.163] helo=kentang.home) by mail.default.ilande.uk0.bigv.io with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.89) (envelope-from ) id 1jGqkT-0001H4-V1; Tue, 24 Mar 2020 21:06:14 +0000 From: Mark Cave-Ayland To: peter.maydell@linaro.org, jsnow@redhat.com, balaton@eik.bme.hu, qemu-devel@nongnu.org, qemu-ppc@nongnu.org, qemu-block@nongnu.org Date: Tue, 24 Mar 2020 21:05:19 +0000 Message-Id: <20200324210519.2974-4-mark.cave-ayland@ilande.co.uk> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200324210519.2974-1-mark.cave-ayland@ilande.co.uk> References: <20200324210519.2974-1-mark.cave-ayland@ilande.co.uk> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-SA-Exim-Connect-IP: 86.130.37.163 X-SA-Exim-Mail-From: mark.cave-ayland@ilande.co.uk Subject: [PATCH for-5.0 3/3] cmd646-ide: use qdev gpio rather than qemu_allocate_irqs() X-SA-Exim-Version: 4.2.1 (built Tue, 02 Aug 2016 21:08:31 +0000) X-SA-Exim-Scanned: Yes (on mail.default.ilande.uk0.bigv.io) X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2001:41c9:1:41f::167 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" 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 --- 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, uint3= 2_t addr, uint32_t val, static void pci_cmd646_ide_realize(PCIDevice *dev, Error **errp) { PCIIDEState *d =3D PCI_IDE(dev); + DeviceState *ds =3D DEVICE(dev); uint8_t *pci_conf =3D dev->config; - qemu_irq *irq; int i; =20 pci_conf[PCI_CLASS_PROG] =3D 0x8f; @@ -291,16 +291,15 @@ static void pci_cmd646_ide_realize(PCIDevice *dev, Er= ror **errp) /* TODO: RST# value should be 0 */ pci_conf[PCI_INTERRUPT_PIN] =3D 0x01; // interrupt on pin 1 =20 - irq =3D qemu_allocate_irqs(cmd646_set_irq, d, 2); + qdev_init_gpio_in(ds, cmd646_set_irq, 2); for (i =3D 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)); =20 bmdma_init(&d->bus[i], &d->bmdma[i], d); d->bmdma[i].bus =3D &d->bus[i]; ide_register_restart_cb(&d->bus[i]); } - g_free(irq); } =20 static void pci_cmd646_ide_exitfn(PCIDevice *dev) --=20 2.20.1