qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Shannon Zhao <zhaoshenglong@huawei.com>
To: qemu-devel@nongnu.org
Cc: qemu-trivial@nongnu.org, mjt@tls.msk.ru, shannon.zhao@linaro.org
Subject: [Qemu-devel] [PATCH 06/10] hw/arm/palm.c: Fix misusing qemu_allocate_irqs
Date: Thu, 2 Jul 2015 17:49:19 +0800	[thread overview]
Message-ID: <1435830563-3072-7-git-send-email-zhaoshenglong@huawei.com> (raw)
In-Reply-To: <1435830563-3072-1-git-send-email-zhaoshenglong@huawei.com>

From: Shannon Zhao <shannon.zhao@linaro.org>

Use qemu_allocate_irq instead of qemu_allocate_irqs to fix memory leak.

Signed-off-by: Shannon Zhao <zhaoshenglong@huawei.com>
Signed-off-by: Shannon Zhao <shannon.zhao@linaro.org>
---
 hw/arm/palm.c | 24 ++++++++++++++----------
 1 file changed, 14 insertions(+), 10 deletions(-)

diff --git a/hw/arm/palm.c b/hw/arm/palm.c
index 7f1cfb8..f73c8a2 100644
--- a/hw/arm/palm.c
+++ b/hw/arm/palm.c
@@ -158,21 +158,25 @@ static void palmte_onoff_gpios(void *opaque, int line, int level)
 
 static void palmte_gpio_setup(struct omap_mpu_state_s *cpu)
 {
-    qemu_irq *misc_gpio;
-
     omap_mmc_handlers(cpu->mmc,
                     qdev_get_gpio_in(cpu->gpio, PALMTE_MMC_WP_GPIO),
                     qemu_irq_invert(omap_mpuio_in_get(cpu->mpuio)
                             [PALMTE_MMC_SWITCH_GPIO]));
 
-    misc_gpio = qemu_allocate_irqs(palmte_onoff_gpios, cpu, 7);
-    qdev_connect_gpio_out(cpu->gpio, PALMTE_MMC_POWER_GPIO,	misc_gpio[0]);
-    qdev_connect_gpio_out(cpu->gpio, PALMTE_SPEAKER_GPIO,	misc_gpio[1]);
-    qdev_connect_gpio_out(cpu->gpio, 11,			misc_gpio[2]);
-    qdev_connect_gpio_out(cpu->gpio, 12,			misc_gpio[3]);
-    qdev_connect_gpio_out(cpu->gpio, 13,			misc_gpio[4]);
-    omap_mpuio_out_set(cpu->mpuio, 1,				misc_gpio[5]);
-    omap_mpuio_out_set(cpu->mpuio, 3,				misc_gpio[6]);
+    qdev_connect_gpio_out(cpu->gpio, PALMTE_MMC_POWER_GPIO,
+                          qemu_allocate_irq(palmte_onoff_gpios, cpu, 0));
+    qdev_connect_gpio_out(cpu->gpio, PALMTE_SPEAKER_GPIO,
+                          qemu_allocate_irq(palmte_onoff_gpios, cpu, 1));
+    qdev_connect_gpio_out(cpu->gpio, 11,
+                          qemu_allocate_irq(palmte_onoff_gpios, cpu, 2));
+    qdev_connect_gpio_out(cpu->gpio, 12,
+                          qemu_allocate_irq(palmte_onoff_gpios, cpu, 3));
+    qdev_connect_gpio_out(cpu->gpio, 13,
+                          qemu_allocate_irq(palmte_onoff_gpios, cpu, 4));
+    omap_mpuio_out_set(cpu->mpuio, 1,
+                       qemu_allocate_irq(palmte_onoff_gpios, cpu, 5));
+    omap_mpuio_out_set(cpu->mpuio, 3,
+                       qemu_allocate_irq(palmte_onoff_gpios, cpu, 6));
 
     /* Reset some inputs to initial state.  */
     qemu_irq_lower(qdev_get_gpio_in(cpu->gpio, PALMTE_USBDETECT_GPIO));
-- 
2.0.4

  parent reply	other threads:[~2015-07-02  9:50 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-07-02  9:49 [Qemu-devel] [PATCH 00/10] fix memory leak Shannon Zhao
2015-07-02  9:49 ` [Qemu-devel] [PATCH 01/10] hw/ppc/ppc4xx_devs.c: Convert ppcuic to QOM Shannon Zhao
2015-07-02  9:49 ` [Qemu-devel] [PATCH 02/10] include/hw/sparc/grlib.h: Store irqs in DeviceState Shannon Zhao
2015-07-02  9:49 ` [Qemu-devel] [PATCH 03/10] hw/m68k/mcf5206.c: convert m5206_mbar to QOM Shannon Zhao
2015-07-02  9:49 ` [Qemu-devel] [PATCH 04/10] hw/m68k/mcf_intc.c: convert mcf_intc " Shannon Zhao
2015-07-02  9:49 ` [Qemu-devel] [PATCH 05/10] hw/sh4/r2d.c: convert r2d_fpga " Shannon Zhao
2015-07-02  9:49 ` Shannon Zhao [this message]
2015-07-02  9:49 ` [Qemu-devel] [PATCH 07/10] hw/arm/spitz.c: Fix misusing qemu_allocate_irqs Shannon Zhao
2015-07-02  9:49 ` [Qemu-devel] [PATCH 08/10] hw/arm/tosa.c: " Shannon Zhao
2015-07-02  9:49 ` [Qemu-devel] [PATCH 09/10] hw/mips/mips_int.c: use qemu_allocate_irq to fix memory leak Shannon Zhao
2015-07-02  9:49 ` [Qemu-devel] [PATCH 10/10] hw/openrisc/pic_cpu.c: " Shannon Zhao

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=1435830563-3072-7-git-send-email-zhaoshenglong@huawei.com \
    --to=zhaoshenglong@huawei.com \
    --cc=mjt@tls.msk.ru \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-trivial@nongnu.org \
    --cc=shannon.zhao@linaro.org \
    /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).