From patchwork Sat May 30 07:54:34 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shannon Zhao X-Patchwork-Id: 49253 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-lb0-f200.google.com (mail-lb0-f200.google.com [209.85.217.200]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 99BA722B40 for ; Sat, 30 May 2015 07:59:32 +0000 (UTC) Received: by lbbti3 with SMTP id ti3sf24239121lbb.1 for ; Sat, 30 May 2015 00:59:31 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:from:to:date:message-id:in-reply-to :references:mime-version:content-type:cc:subject:precedence:list-id :list-unsubscribe:list-archive:list-post:list-help:list-subscribe :errors-to:sender:x-original-sender :x-original-authentication-results:mailing-list; bh=rD7B4eALW9aA/ieZJB+UmXURak1Ocrr1jmBUM8bwIBc=; b=H5s/XEzidP4bwz+MMw7lMczVRpegH6qDq+bCEmKqc6NmNjOEzqsB0hO+p7uHknKpxc wEVO2o/cwjHqKihJH2tU3y32wd9r2Lslq0naPqAQi2AeQkpRGTIRP4DLqZaodvBpAkAg AgUj7fVfI20CLCqvohkhZ+w0xcao6YiL0qwtOLg0rSohwlakzTZmPlMR9JAiC+kUJYl5 doTg71XhNyvlgmXou6rC6AqmSOX4T+gegnOG72utgbhOd8H/bUxCnHo7Djf5xTJJjGUg WLalj59yOYCx6vfNebNYeOKv56RrcbjGJ53L5gAUDvod1l0RJp32FfSTI6lu57A8lFOH rYoQ== X-Gm-Message-State: ALoCoQk++j1QkfgPyb263mLc2ueNvruoV3/BcHZphTmWRVY0eNzC+VJuFPbe7NqQZ9HhRWI7jPD+ X-Received: by 10.112.28.111 with SMTP id a15mr10768295lbh.21.1432972771229; Sat, 30 May 2015 00:59:31 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.30.37 with SMTP id p5ls455430lah.9.gmail; Sat, 30 May 2015 00:59:31 -0700 (PDT) X-Received: by 10.112.125.166 with SMTP id mr6mr11177133lbb.83.1432972771117; Sat, 30 May 2015 00:59:31 -0700 (PDT) Received: from mail-la0-f49.google.com (mail-la0-f49.google.com. [209.85.215.49]) by mx.google.com with ESMTPS id uo6si6789128lbc.21.2015.05.30.00.59.30 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 30 May 2015 00:59:30 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.49 as permitted sender) client-ip=209.85.215.49; Received: by labpy14 with SMTP id py14so58827627lab.0 for ; Sat, 30 May 2015 00:59:30 -0700 (PDT) X-Received: by 10.153.6.36 with SMTP id cr4mr12027536lad.56.1432972770893; Sat, 30 May 2015 00:59:30 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.108.230 with SMTP id hn6csp888266lbb; Sat, 30 May 2015 00:59:30 -0700 (PDT) X-Received: by 10.55.17.79 with SMTP id b76mr23504937qkh.70.1432972769570; Sat, 30 May 2015 00:59:29 -0700 (PDT) Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id q22si8032137qkh.117.2015.05.30.00.59.28 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Sat, 30 May 2015 00:59:29 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) client-ip=2001:4830:134:3::11; Received: from localhost ([::1]:38648 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Yybg0-00037G-Pc for patch@linaro.org; Sat, 30 May 2015 03:59:28 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52805) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YybfD-0001zP-Tc for qemu-devel@nongnu.org; Sat, 30 May 2015 03:58:41 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YybfC-0000Yi-OP for qemu-devel@nongnu.org; Sat, 30 May 2015 03:58:39 -0400 Received: from szxga03-in.huawei.com ([119.145.14.66]:28723) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Yybf7-0000X4-Dp; Sat, 30 May 2015 03:58:33 -0400 Received: from 172.24.2.119 (EHLO szxeml431-hub.china.huawei.com) ([172.24.2.119]) by szxrg03-dlp.huawei.com (MOS 4.4.3-GA FastPath queued) with ESMTP id BGU05486; Sat, 30 May 2015 15:55:12 +0800 (CST) Received: from HGHY1Z002260041.china.huawei.com (10.177.16.142) by szxeml431-hub.china.huawei.com (10.82.67.208) with Microsoft SMTP Server id 14.3.158.1; Sat, 30 May 2015 15:55:01 +0800 From: Shannon Zhao To: Date: Sat, 30 May 2015 15:54:34 +0800 Message-ID: <1432972477-13504-5-git-send-email-zhaoshenglong@huawei.com> X-Mailer: git-send-email 1.9.0.msysgit.0 In-Reply-To: <1432972477-13504-1-git-send-email-zhaoshenglong@huawei.com> References: <1432972477-13504-1-git-send-email-zhaoshenglong@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.177.16.142] X-CFilter-Loop: Reflected X-Mirapoint-Virus-RAPID-Raw: score=unknown(0), refid=str=0001.0A020201.55696CE0.0138, ss=1, re=0.000, recu=0.000, reip=0.000, cl=1, cld=1, fgs=0, ip=0.0.0.0, so=2013-05-26 15:14:31, dmn=2013-03-21 17:37:32 X-Mirapoint-Loop-Id: afb195cf1cdd28cd1e8351513c9a40a8 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4.x-2.6.x [generic] X-Received-From: 119.145.14.66 Cc: qemu-trivial@nongnu.org, peter.maydell@linaro.org, mjt@tls.msk.ru, shannon.zhao@linaro.org Subject: [Qemu-devel] [PATCH v2 4/7] hw/sh4/r2d.c: Store irq array in MachineState to fix memory leak X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: , List-Help: , List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: patch@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.49 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 From: Shannon Zhao Signed-off-by: Shannon Zhao Signed-off-by: Shannon Zhao --- hw/sh4/r2d.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/hw/sh4/r2d.c b/hw/sh4/r2d.c index 4221060..39edefd 100644 --- a/hw/sh4/r2d.c +++ b/hw/sh4/r2d.c @@ -230,7 +230,6 @@ static void r2d_init(MachineState *machine) ResetData *reset_info; struct SH7750State *s; MemoryRegion *sdram = g_new(MemoryRegion, 1); - qemu_irq *irq; DriveInfo *dinfo; int i; DeviceState *dev; @@ -260,7 +259,7 @@ static void r2d_init(MachineState *machine) memory_region_add_subregion(address_space_mem, SDRAM_BASE, sdram); /* Register peripherals */ s = sh7750_init(cpu, address_space_mem); - irq = r2d_fpga_init(address_space_mem, 0x04000000, sh7750_irl(s)); + machine->irqs = r2d_fpga_init(address_space_mem, 0x04000000, sh7750_irl(s)); dev = qdev_create(NULL, "sh_pci"); busdev = SYS_BUS_DEVICE(dev); @@ -268,19 +267,19 @@ static void r2d_init(MachineState *machine) pci_bus = PCI_BUS(qdev_get_child_bus(dev, "pci")); sysbus_mmio_map(busdev, 0, P4ADDR(0x1e200000)); sysbus_mmio_map(busdev, 1, A7ADDR(0x1e200000)); - sysbus_connect_irq(busdev, 0, irq[PCI_INTA]); - sysbus_connect_irq(busdev, 1, irq[PCI_INTB]); - sysbus_connect_irq(busdev, 2, irq[PCI_INTC]); - sysbus_connect_irq(busdev, 3, irq[PCI_INTD]); + sysbus_connect_irq(busdev, 0, machine->irqs[PCI_INTA]); + sysbus_connect_irq(busdev, 1, machine->irqs[PCI_INTB]); + sysbus_connect_irq(busdev, 2, machine->irqs[PCI_INTC]); + sysbus_connect_irq(busdev, 3, machine->irqs[PCI_INTD]); sm501_init(address_space_mem, 0x10000000, SM501_VRAM_SIZE, - irq[SM501], serial_hds[2]); + machine->irqs[SM501], serial_hds[2]); /* onboard CF (True IDE mode, Master only). */ dinfo = drive_get(IF_IDE, 0, 0); dev = qdev_create(NULL, "mmio-ide"); busdev = SYS_BUS_DEVICE(dev); - sysbus_connect_irq(busdev, 0, irq[CF_IDE]); + sysbus_connect_irq(busdev, 0, machine->irqs[CF_IDE]); qdev_prop_set_uint32(dev, "shift", 1); qdev_init_nofail(dev); sysbus_mmio_map(busdev, 0, 0x14001000);