diff mbox

[07/10] hw/arm/spitz.c: Fix misusing qemu_allocate_irqs

Message ID 1435830563-3072-8-git-send-email-zhaoshenglong@huawei.com
State New
Headers show

Commit Message

Shannon Zhao July 2, 2015, 9:49 a.m. UTC
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/spitz.c | 23 ++++++++++++++---------
 1 file changed, 14 insertions(+), 9 deletions(-)
diff mbox

Patch

diff --git a/hw/arm/spitz.c b/hw/arm/spitz.c
index 5bf032a..d51180a 100644
--- a/hw/arm/spitz.c
+++ b/hw/arm/spitz.c
@@ -815,19 +815,24 @@  static void spitz_out_switch(void *opaque, int line, int level)
 static void spitz_scoop_gpio_setup(PXA2xxState *cpu,
                 DeviceState *scp0, DeviceState *scp1)
 {
-    qemu_irq *outsignals = qemu_allocate_irqs(spitz_out_switch, cpu, 8);
-
-    qdev_connect_gpio_out(scp0, SPITZ_SCP_CHRG_ON, outsignals[0]);
-    qdev_connect_gpio_out(scp0, SPITZ_SCP_JK_B, outsignals[1]);
-    qdev_connect_gpio_out(scp0, SPITZ_SCP_LED_GREEN, outsignals[2]);
-    qdev_connect_gpio_out(scp0, SPITZ_SCP_LED_ORANGE, outsignals[3]);
+    qdev_connect_gpio_out(scp0, SPITZ_SCP_CHRG_ON,
+                          qemu_allocate_irq(spitz_out_switch, cpu, 0));
+    qdev_connect_gpio_out(scp0, SPITZ_SCP_JK_B,
+                          qemu_allocate_irq(spitz_out_switch, cpu, 1));
+    qdev_connect_gpio_out(scp0, SPITZ_SCP_LED_GREEN,
+                          qemu_allocate_irq(spitz_out_switch, cpu, 2));
+    qdev_connect_gpio_out(scp0, SPITZ_SCP_LED_ORANGE,
+                          qemu_allocate_irq(spitz_out_switch, cpu, 3));
 
     if (scp1) {
-        qdev_connect_gpio_out(scp1, SPITZ_SCP2_BACKLIGHT_CONT, outsignals[4]);
-        qdev_connect_gpio_out(scp1, SPITZ_SCP2_BACKLIGHT_ON, outsignals[5]);
+        qdev_connect_gpio_out(scp1, SPITZ_SCP2_BACKLIGHT_CONT,
+                              qemu_allocate_irq(spitz_out_switch, cpu, 4));
+        qdev_connect_gpio_out(scp1, SPITZ_SCP2_BACKLIGHT_ON,
+                              qemu_allocate_irq(spitz_out_switch, cpu, 5));
     }
 
-    qdev_connect_gpio_out(scp0, SPITZ_SCP_ADC_TEMP_ON, outsignals[6]);
+    qdev_connect_gpio_out(scp0, SPITZ_SCP_ADC_TEMP_ON,
+                          qemu_allocate_irq(spitz_out_switch, cpu, 6));
 }
 
 #define SPITZ_GPIO_HSYNC		22