From patchwork Fri May 29 05:27:02 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shannon Zhao X-Patchwork-Id: 49135 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wg0-f70.google.com (mail-wg0-f70.google.com [74.125.82.70]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 225D222B3A for ; Fri, 29 May 2015 05:32:50 +0000 (UTC) Received: by wgv5 with SMTP id 5sf10781781wgv.0 for ; Thu, 28 May 2015 22:32:49 -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=03u5QWkjlebVP7m/i3vSISrQea1pRXED3KeDw2Csmos=; b=S7CXeF1qbpaKK2lXcit1sp1NkUE3zp3hsgCGSuZWBvI7rYopfa90ns08owDw2pqVGa Fg+hdPRBlqFOwaw6xqy3+gdsE4KAIDBqSPnTRSM45DQ2HUO4sqxN/mY5Yjw/33GvUTPG SDZp/W2SrUYmGtweUgAFTlOIhyfeZsjOwdR0uJj1iIFwQfDdg71b6GlPtPT82zFqDF63 /NSwRBib0nDDqUfMbo1xiqyeu5BeStK8hUqOYKrVD0qrWZ0qkY97e4kqqsWmRwPdKaD4 YuKYPNUvVTxVPKp2qcfvajG5zru/I798HGtDR0pbEuS0e1u5jWZLBNyNA25atB0EiWj9 D79w== X-Gm-Message-State: ALoCoQlbQiCfT7HE3xF/T5EOsA53dOUmm+HiLVitof2MUfBg6WfB9YsZr8wITZ8px6ceNyODxSao X-Received: by 10.112.122.39 with SMTP id lp7mr5756744lbb.5.1432877569354; Thu, 28 May 2015 22:32:49 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.5.101 with SMTP id r5ls265171lar.78.gmail; Thu, 28 May 2015 22:32:49 -0700 (PDT) X-Received: by 10.152.18.199 with SMTP id y7mr6145141lad.39.1432877569243; Thu, 28 May 2015 22:32:49 -0700 (PDT) Received: from mail-la0-f52.google.com (mail-la0-f52.google.com. [209.85.215.52]) by mx.google.com with ESMTPS id je10si3790975lac.49.2015.05.28.22.32.48 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 28 May 2015 22:32:48 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.52 as permitted sender) client-ip=209.85.215.52; Received: by labko7 with SMTP id ko7so44160022lab.2 for ; Thu, 28 May 2015 22:32:48 -0700 (PDT) X-Received: by 10.112.163.168 with SMTP id yj8mr6274605lbb.36.1432877568833; Thu, 28 May 2015 22:32:48 -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 hn6csp34331lbb; Thu, 28 May 2015 22:32:48 -0700 (PDT) X-Received: by 10.55.56.205 with SMTP id f196mr12706306qka.68.1432877567605; Thu, 28 May 2015 22:32:47 -0700 (PDT) Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id y12si4696450qky.16.2015.05.28.22.32.46 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Thu, 28 May 2015 22:32:47 -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]:33556 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YyCuU-00068L-IZ for patch@linaro.org; Fri, 29 May 2015 01:32:46 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:39692) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YyCqC-0006PD-BE for qemu-devel@nongnu.org; Fri, 29 May 2015 01:28:21 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YyCq6-0005Dp-UF for qemu-devel@nongnu.org; Fri, 29 May 2015 01:28:20 -0400 Received: from szxga02-in.huawei.com ([119.145.14.65]:5294) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YyCq6-0005D1-Cq; Fri, 29 May 2015 01:28:14 -0400 Received: from 172.24.2.119 (EHLO SZXEML429-HUB.china.huawei.com) ([172.24.2.119]) by szxrg02-dlp.huawei.com (MOS 4.3.7-GA FastPath queued) with ESMTP id CMB71953; Fri, 29 May 2015 13:28:05 +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:27:54 +0800 From: Shannon Zhao To: Date: Fri, 29 May 2015 13:27:02 +0800 Message-ID: <1432877231-5136-5-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-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4.x-2.6.x [generic] X-Received-From: 119.145.14.65 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 04/13] hw/timer/arm_timer.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.215.52 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: ==16356== 32 bytes in 2 blocks are definitely lost in loss record 1,689 of 2,802 ==16356== at 0x4C2845D: malloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so) ==16356== by 0x35478F: malloc_and_trace (vl.c:2556) ==16356== by 0x64C770E: g_malloc (in /usr/lib64/libglib-2.0.so.0.3600.3) ==16356== by 0x3ED94B: qemu_extend_irqs (irq.c:55) ==16356== by 0x3ED9D7: qemu_allocate_irqs (irq.c:64) ==16356== by 0x4BA8D1: sp804_init (arm_timer.c:285) ==16356== by 0x3EEE1D: sysbus_device_init (sysbus.c:204) ==16356== by 0x3E838D: device_realize (qdev.c:247) ==16356== by 0x3EA48C: device_set_realized (qdev.c:1058) ==16356== by 0x516CD2: property_set_bool (object.c:1514) ==16356== by 0x5155CC: object_property_set (object.c:837) ==16356== by 0x5178EE: object_property_set_qobject (qom-qobject.c:24) Signed-off-by: Shannon Zhao Signed-off-by: Shannon Zhao --- hw/timer/arm_timer.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/hw/timer/arm_timer.c b/hw/timer/arm_timer.c index 1452910..d53f39a 100644 --- a/hw/timer/arm_timer.c +++ b/hw/timer/arm_timer.c @@ -280,14 +280,12 @@ static int sp804_init(SysBusDevice *sbd) { DeviceState *dev = DEVICE(sbd); SP804State *s = SP804(dev); - qemu_irq *qi; - qi = qemu_allocate_irqs(sp804_set_irq, s, 2); sysbus_init_irq(sbd, &s->irq); s->timer[0] = arm_timer_init(s->freq0); s->timer[1] = arm_timer_init(s->freq1); - s->timer[0]->irq = qi[0]; - s->timer[1]->irq = qi[1]; + s->timer[0]->irq = qemu_allocate_irq(sp804_set_irq, s, 0); + s->timer[1]->irq = qemu_allocate_irq(sp804_set_irq, s, 1); memory_region_init_io(&s->iomem, OBJECT(s), &sp804_ops, s, "sp804", 0x1000); sysbus_init_mmio(sbd, &s->iomem);