Message ID | 20171006235023.11952-77-f4bug@amsat.org |
---|---|
State | New |
Headers | show
Return-Path: <qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org> X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=<UNKNOWN>) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="ddgwKw1C"; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3y87K55Qfjz9t2m for <incoming@patchwork.ozlabs.org>; Sat, 7 Oct 2017 11:52:57 +1100 (AEDT) Received: from localhost ([::1]:47899 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from <qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>) id 1e0dMN-0002aG-S0 for incoming@patchwork.ozlabs.org; Fri, 06 Oct 2017 20:52:55 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:43701) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from <philippe.mathieu.daude@gmail.com>) id 1e0cSO-0002Jw-Er for qemu-devel@nongnu.org; Fri, 06 Oct 2017 19:55:07 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from <philippe.mathieu.daude@gmail.com>) id 1e0cSN-00085j-Na for qemu-devel@nongnu.org; Fri, 06 Oct 2017 19:55:04 -0400 Received: from mail-qt0-x241.google.com ([2607:f8b0:400d:c0d::241]:52775) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from <philippe.mathieu.daude@gmail.com>) id 1e0cSN-00084x-Je; Fri, 06 Oct 2017 19:55:03 -0400 Received: by mail-qt0-x241.google.com with SMTP id o52so34330014qtc.9; Fri, 06 Oct 2017 16:55:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=rR36fwBv7mScxAVZSpIrXHl8/e30rqjRXFK308/5Kd8=; b=ddgwKw1Cm5XMP/a13chBsQYTR9Y9t+yvvAqd65R+tZaTRyzLoWkhtmY/85gn5NAILN 6eSQJZWZRDqGwId4KTu/VxJKUhqS724YHgv97qBe/MXg9SjCKvk/lrfqw0gCLwcDn+MK AJbIkCNUQJdxOAUhilavgVDQad1ipsbbllLzUv14MNOQnIOr1U/OxOXBhCe0iN+THSKy LMj8P0PGOiQlp3oiQyripAw71U1YRGp3rjwQztmV5Xk10RSt2r4OW1B+FfNjfZqblsFZ 5YWFu4aJN46qHZUILYViozuQfeM+wr/lsz7tsHOn23syOSV6zAg3ZSg7stzEdb7u+flQ wNZw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=rR36fwBv7mScxAVZSpIrXHl8/e30rqjRXFK308/5Kd8=; b=G//QWC/Tm8Um3+5TDcmr9Po+Y53EQX68gDwNloqQF5a/LjVX6lHOdI11JUBLYTS6Tq R1rY47JhF5Eah6RGO6L6/ewxXLWl2N8x0wQNU4mYANDfjctyGNEEjJyuJO3zjeANibFh XPsW2iw53bttKQBz750TnZYSZ69O4bexJljXcPJhzg1yeC73JWCyA2cn8Pt0cALBrr6R DoLli5VDKN4RhVKBCklVHcgA8UafRjhedhf/FpvCjBPEoOq+WZfxs3imJ2tNaIgai8G6 EpDIC1ZT4Q4Ml2poPnfCGXdbG3vMZIm7LSWQcxopufMciF3/muRmzD+k/IN7GRinfWtd Vfsg== X-Gm-Message-State: AMCzsaU9NICRJJY1KvykUA1a5RSsEdLnwuRybis7D8Ji+2M+Qa3URT3w /P9YO/y0WCNOGIgT4r+UfPk= X-Google-Smtp-Source: AOwi7QCbwU3hNN7FEa0ntcxezQ7sS1QoBNLfSkVkRO3RH7TjN5WrYzWtUVRvt1I9RF7hvvs6/uu93A== X-Received: by 10.200.56.108 with SMTP id r41mr5071728qtb.143.1507334103062; Fri, 06 Oct 2017 16:55:03 -0700 (PDT) Received: from yoga.lan ([181.93.89.178]) by smtp.gmail.com with ESMTPSA id g1sm1705226qta.95.2017.10.06.16.55.00 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 06 Oct 2017 16:55:02 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= <f4bug@amsat.org> To: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= <marcandre.lureau@gmail.com>, Markus Armbruster <armbru@redhat.com>, Eric Blake <eblake@redhat.com>, Stefan Hajnoczi <stefanha@redhat.com>, "Edgar E. Iglesias" <edgar.iglesias@gmail.com> Date: Fri, 6 Oct 2017 20:50:11 -0300 Message-Id: <20171006235023.11952-77-f4bug@amsat.org> X-Mailer: git-send-email 2.14.2 In-Reply-To: <20171006235023.11952-1-f4bug@amsat.org> References: <20171006235023.11952-1-f4bug@amsat.org> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:400d:c0d::241 Subject: [Qemu-devel] [PATCH 76/88] dma: use g_new() family of functions X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: <qemu-devel.nongnu.org> List-Unsubscribe: <https://lists.nongnu.org/mailman/options/qemu-devel>, <mailto:qemu-devel-request@nongnu.org?subject=unsubscribe> List-Archive: <http://lists.nongnu.org/archive/html/qemu-devel/> List-Post: <mailto:qemu-devel@nongnu.org> List-Help: <mailto:qemu-devel-request@nongnu.org?subject=help> List-Subscribe: <https://lists.nongnu.org/mailman/listinfo/qemu-devel>, <mailto:qemu-devel-request@nongnu.org?subject=subscribe> Cc: Kevin Wolf <kwolf@redhat.com>, =?utf-8?q?Marc-Andr=C3=A9_Lureau?= <marcandre.lureau@redhat.com>, qemu trival <qemu-trivial@nongnu.org>, qemu-devel@nongnu.org, =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= <f4bug@amsat.org> Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" <qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org> |
Series |
use g_new() family of functions
|
expand
|
diff --git a/dma-helpers.c b/dma-helpers.c index 2d7e02d35e..e327fc21c4 100644 --- a/dma-helpers.c +++ b/dma-helpers.c @@ -40,7 +40,7 @@ int dma_memory_set(AddressSpace *as, dma_addr_t addr, uint8_t c, dma_addr_t len) void qemu_sglist_init(QEMUSGList *qsg, DeviceState *dev, int alloc_hint, AddressSpace *as) { - qsg->sg = g_malloc(alloc_hint * sizeof(ScatterGatherEntry)); + qsg->sg = g_new(ScatterGatherEntry, alloc_hint); qsg->nsg = 0; qsg->nalloc = alloc_hint; qsg->size = 0; @@ -53,7 +53,7 @@ void qemu_sglist_add(QEMUSGList *qsg, dma_addr_t base, dma_addr_t len) { if (qsg->nsg == qsg->nalloc) { qsg->nalloc = 2 * qsg->nalloc + 1; - qsg->sg = g_realloc(qsg->sg, qsg->nalloc * sizeof(ScatterGatherEntry)); + qsg->sg = g_renew(ScatterGatherEntry, qsg->sg, qsg->nalloc); } qsg->sg[qsg->nsg].base = base; qsg->sg[qsg->nsg].len = len; diff --git a/hw/dma/etraxfs_dma.c b/hw/dma/etraxfs_dma.c index d5650eb885..97951a2abe 100644 --- a/hw/dma/etraxfs_dma.c +++ b/hw/dma/etraxfs_dma.c @@ -768,7 +768,7 @@ void *etraxfs_dmac_init(hwaddr base, int nr_channels) { struct fs_dma_ctrl *ctrl = NULL; - ctrl = g_malloc0(sizeof *ctrl); + ctrl = g_new0(struct fs_dma_ctrl, 1); ctrl->bh = qemu_bh_new(DMA_run, ctrl); diff --git a/hw/dma/rc4030.c b/hw/dma/rc4030.c index 5d4833eeca..14bcab9fb3 100644 --- a/hw/dma/rc4030.c +++ b/hw/dma/rc4030.c @@ -636,8 +636,8 @@ static rc4030_dma *rc4030_allocate_dmas(void *opaque, int n) struct rc4030DMAState *p; int i; - s = (rc4030_dma *)g_malloc0(sizeof(rc4030_dma) * n); - p = (struct rc4030DMAState *)g_malloc0(sizeof(struct rc4030DMAState) * n); + s = g_new0(rc4030_dma, n); + p = g_new0(struct rc4030DMAState, n); for (i = 0; i < n; i++) { p->opaque = opaque; p->n = i;