From patchwork Fri May 29 05:27:08 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shannon Zhao X-Patchwork-Id: 49133 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-lb0-f199.google.com (mail-lb0-f199.google.com [209.85.217.199]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id DB7E722B3A for ; Fri, 29 May 2015 05:32:27 +0000 (UTC) Received: by lbbqq2 with SMTP id qq2sf15658928lbb.0 for ; Thu, 28 May 2015 22:32:26 -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=W0vJr+oF5yBYP3yJtP6EuNjt9PpmfGBPlXgkokDTFfI=; b=K90ZQ9U379kgyrJGP+2AM9RrkRvgsAadBNkzI1BDmPbnCyBoE9ZLCByoqa++/Pr2o9 WdJP6xImnwjFkP+PdJgzcXvl7+HdXyUXPGeY2HFEJcYfi/4ZLpxw9S+fh3SC/PPh31IC kNw+l49JNrKm5aJQLahS0DeKOR7D/8qPadtzxReDjyLBQVw1c3F/b8xSH7XpXgU7YI/A RkJgTSoynz6Dc2+HDjvqemTyyIrXyS7lWmrnkAdmxQQtE0kPQBZtxr322jwDq3dFdoZu qYyfyXQilPfWbwhKwzRP/ftEv/gQW6xVLWLqvYQOzVd5iD1QTI3eZ801ekuNIDFJCY+F 6EVw== X-Gm-Message-State: ALoCoQmCsPblVLzXwDbeJRGeZXLc6z5xcPAcKoQDaQSjhDopvJRY2nyXvlR3j8nAU16WRgO9FOo5 X-Received: by 10.180.36.111 with SMTP id p15mr17992wij.6.1432877546499; Thu, 28 May 2015 22:32:26 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.44.135 with SMTP id e7ls317265lam.79.gmail; Thu, 28 May 2015 22:32:26 -0700 (PDT) X-Received: by 10.112.120.199 with SMTP id le7mr6191774lbb.48.1432877546372; Thu, 28 May 2015 22:32:26 -0700 (PDT) Received: from mail-lb0-f182.google.com (mail-lb0-f182.google.com. [209.85.217.182]) by mx.google.com with ESMTPS id r9si3802941lae.5.2015.05.28.22.32.26 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 28 May 2015 22:32:26 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.182 as permitted sender) client-ip=209.85.217.182; Received: by lbbuc2 with SMTP id uc2so41770413lbb.2 for ; Thu, 28 May 2015 22:32:26 -0700 (PDT) X-Received: by 10.112.204.6 with SMTP id ku6mr6226235lbc.73.1432877545962; Thu, 28 May 2015 22:32:25 -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 hn6csp34173lbb; Thu, 28 May 2015 22:32:25 -0700 (PDT) X-Received: by 10.55.15.129 with SMTP id 1mr12717300qkp.29.1432877545206; Thu, 28 May 2015 22:32:25 -0700 (PDT) Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id o3si4663841qkh.76.2015.05.28.22.32.24 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Thu, 28 May 2015 22:32:25 -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]:33554 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YyCu8-0005Tc-As for patch@linaro.org; Fri, 29 May 2015 01:32:24 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:39657) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YyCqB-0006NW-HV for qemu-devel@nongnu.org; Fri, 29 May 2015 01:28:20 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YyCqA-0005F9-69 for qemu-devel@nongnu.org; Fri, 29 May 2015 01:28:19 -0400 Received: from szxga03-in.huawei.com ([119.145.14.66]:21701) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YyCq9-0005EF-KA; Fri, 29 May 2015 01:28:18 -0400 Received: from 172.24.2.119 (EHLO SZXEML429-HUB.china.huawei.com) ([172.24.2.119]) by szxrg03-dlp.huawei.com (MOS 4.4.3-GA FastPath queued) with ESMTP id BGS73956; Fri, 29 May 2015 13:28:11 +0800 (CST) Received: from HGHY1Z002260041.china.huawei.com (10.177.16.142) by SZXEML429-HUB.china.huawei.com (10.82.67.184) with Microsoft SMTP Server id 14.3.158.1; Fri, 29 May 2015 13:28:02 +0800 From: Shannon Zhao To: Date: Fri, 29 May 2015 13:27:08 +0800 Message-ID: <1432877231-5136-11-git-send-email-zhaoshenglong@huawei.com> X-Mailer: git-send-email 1.9.0.msysgit.0 In-Reply-To: <1432877231-5136-1-git-send-email-zhaoshenglong@huawei.com> References: <1432877231-5136-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.0A020202.5567F8EB.00E3, 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: 70d02eee22c5f9176dc2740b43ca2665 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, pbonzini@redhat.com, mjt@tls.msk.ru, shannon.zhao@linaro.org, peter.maydell@linaro.org Subject: [Qemu-devel] [PATCH v2 10/13] hw/unicore32/puv3.c: Fix misusing qemu_allocate_irqs for single irq 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.217.182 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 valgrind complains about: ==26001== 8 bytes in 1 blocks are definitely lost in loss record 234 of 1,038 ==26001== at 0x4C2845D: malloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so) ==26001== by 0x1E1483: malloc_and_trace (vl.c:2556) ==26001== by 0x64C770E: g_malloc (in /usr/lib64/libglib-2.0.so.0.3600.3) ==26001== by 0x22D17B: qemu_extend_irqs (irq.c:55) ==26001== by 0x22D207: qemu_allocate_irqs (irq.c:64) ==26001== by 0x1BC56D: puv3_soc_init (puv3.c:49) ==26001== by 0x1BC8B1: puv3_init (puv3.c:128) ==26001== by 0x1E584E: main (vl.c:4249) Signed-off-by: Shannon Zhao Signed-off-by: Shannon Zhao --- hw/unicore32/puv3.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/hw/unicore32/puv3.c b/hw/unicore32/puv3.c index cc9a21a..703e29d 100644 --- a/hw/unicore32/puv3.c +++ b/hw/unicore32/puv3.c @@ -40,15 +40,15 @@ static void puv3_intc_cpu_handler(void *opaque, int irq, int level) static void puv3_soc_init(CPUUniCore32State *env) { - qemu_irq *cpu_intc, irqs[PUV3_IRQS_NR]; + qemu_irq cpu_intc, irqs[PUV3_IRQS_NR]; DeviceState *dev; MemoryRegion *i8042 = g_new(MemoryRegion, 1); int i; /* Initialize interrupt controller */ - cpu_intc = qemu_allocate_irqs(puv3_intc_cpu_handler, - uc32_env_get_cpu(env), 1); - dev = sysbus_create_simple("puv3_intc", PUV3_INTC_BASE, *cpu_intc); + cpu_intc = qemu_allocate_irq(puv3_intc_cpu_handler, + uc32_env_get_cpu(env), 0); + dev = sysbus_create_simple("puv3_intc", PUV3_INTC_BASE, cpu_intc); for (i = 0; i < PUV3_IRQS_NR; i++) { irqs[i] = qdev_get_gpio_in(dev, i); }