From nobody Tue Feb 10 20:31:05 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of _spf.google.com designates 209.85.128.47 as permitted sender) client-ip=209.85.128.47; envelope-from=philippe.mathieu.daude@gmail.com; helo=mail-wm1-f47.google.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of _spf.google.com designates 209.85.128.47 as permitted sender) smtp.mailfrom=philippe.mathieu.daude@gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1635613700; cv=none; d=zohomail.com; s=zohoarc; b=R2KjFu8fQZ+Uh1I6X7wbL3GUjRQcNQ7jIA1gyXEnep53ao0gD4M/aMIAA4Lr5AX4hgMkbYXkg88+Cwl+ICjkQo3PV72XVCp06rfxxhR+x/d2KO3c7S5GTS9d7VCKfmA++EBHSqu+za1B4qvI3k+j+mE4TRXY57t79LyX1NrQ5k0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1635613700; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Sender:Subject:To; bh=tPUCl6tyAoq5QzQAt9TOrxU0VGP68fsKRioKfeBbEdE=; b=KmKDZdMXgSBfaaCcc1zPZU3V/Jj704ddYhE7yk/hqxauL+jtdToxUyldE/efROazaaX2i4+isArp/4IXKtcZ+TG2Qtsk+BoEoa0GEzGJhbSnAAGqMPgNz14xdl2kg5TqDMWoDuYIunhE/b0sYKjwl3LmwHBy56hmFFOOQvHEBy8= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of _spf.google.com designates 209.85.128.47 as permitted sender) smtp.mailfrom=philippe.mathieu.daude@gmail.com Received: from mail-wm1-f47.google.com (mail-wm1-f47.google.com [209.85.128.47]) by mx.zohomail.com with SMTPS id 1635613700845735.9027299736352; Sat, 30 Oct 2021 10:08:20 -0700 (PDT) Received: by mail-wm1-f47.google.com with SMTP id 71so8143803wma.4 for ; Sat, 30 Oct 2021 10:08:20 -0700 (PDT) Return-Path: Return-Path: Received: from x1w.. (62.red-83-57-168.dynamicip.rima-tde.net. [83.57.168.62]) by smtp.gmail.com with ESMTPSA id p3sm8571633wrs.10.2021.10.30.10.08.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 30 Oct 2021 10:08:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=tPUCl6tyAoq5QzQAt9TOrxU0VGP68fsKRioKfeBbEdE=; b=kodKVMZzC5LndVlOuevg09xzswPaRI9W66cxRR9HEY2emjmSnXtav68kydRdR26O69 BrNFH1quZIKqeVIwyi67CA/CsiY/M7XiFv7y5FL0DxXflblSBqYT5O2sdQkii5yS+f8Q p8IX5VLh2ngHc/J7v4+awy+LCTvutlEtsfmDLQzHQKVuTUuA12M8z2EYZGrwktl3QR3K m2N6E9yNqxrhYE4tcz+Y6QyvzWXuaDTvEbbH+kmvLqrpATHDStrNiMfzk8ZgKvoIGjiw 0dH4i7OzKBFnrEUP+KYW1ixBfql6hDq7K76gOQsm2WybBOaDVCPbVmHRNlgyyDGhcVQ0 me6A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=tPUCl6tyAoq5QzQAt9TOrxU0VGP68fsKRioKfeBbEdE=; b=pyf4L0C8gmINHSPyM+gDEAgRVPUBs74FCOrWLhM9uB8+Tj8sjeh1FVMu1L3cxr2Gcr yETfFHH1XVFVPofZLlz8HUQ5aBj/B9izObyTF724WsKsPf03Wue3iJPaDGre1lfadceA gUi6M6VM9bB1V/YK5tLch5oAUGnJqR35GlQOYqMdjl+Idtj1wHj1tU8LvSGbfwEscrPn 7shY/bEwZHKLs+ch65mk+1H9XmM8QW/eDLJoapjyrqGRgjoQSOo/VcE7ZlSDAgB6Qnc0 U4nUMj14B160sJwXgwnB20MUDc8pf1ukRwaHhekHtLTpiHMI0driuc1hOBDB/5o632t1 pfVA== X-Gm-Message-State: AOAM5304OYIymx55V/iUVwhS1KzmnHWy5NGeadb2VsVxAcHubO1OOzKi JUSTmWw8RdKCNVVszJooYTc= X-Google-Smtp-Source: ABdhPJwWED5OUCAdtYAG3SpY6yFSmMPplLL3SpG3F/pZn1/NkkeS0iRUvQuHeYOUk/WgmCLPGnCBmA== X-Received: by 2002:a7b:cf18:: with SMTP id l24mr19264754wmg.39.1635613699175; Sat, 30 Oct 2021 10:08:19 -0700 (PDT) Sender: =?UTF-8?Q?Philippe_Mathieu=2DDaud=C3=A9?= From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Yoshinori Sato , Magnus Damm , Paolo Bonzini , BALATON Zoltan , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PULL 25/30] hw/intc/sh_intc: Simplify allocating sources array Date: Sat, 30 Oct 2021 19:06:10 +0200 Message-Id: <20211030170615.2636436-26-f4bug@amsat.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20211030170615.2636436-1-f4bug@amsat.org> References: <20211030170615.2636436-1-f4bug@amsat.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1635613701694100001 From: BALATON Zoltan Use g_new0 instead of g_malloc0 and avoid some unneeded temporary variable assignments. Signed-off-by: BALATON Zoltan Reviewed-by: Philippe Mathieu-Daud=C3=A9 Message-Id: <72efc4f2c4ff8b96848d03dca08e4541ee4076f6.1635541329.git.balato= n@eik.bme.hu> Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- hw/intc/sh_intc.c | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/hw/intc/sh_intc.c b/hw/intc/sh_intc.c index 1a363d49622..3356b422022 100644 --- a/hw/intc/sh_intc.c +++ b/hw/intc/sh_intc.c @@ -399,21 +399,14 @@ int sh_intc_init(MemoryRegion *sysmem, /* Allocate 4 MemoryRegions per register (2 actions * 2 aliases) */ desc->iomem_aliases =3D g_new0(MemoryRegion, (nr_mask_regs + nr_prio_regs) * 4); - - j =3D 0; - i =3D sizeof(struct intc_source) * nr_sources; - desc->sources =3D g_malloc0(i); - - for (i =3D 0; i < desc->nr_sources; i++) { - struct intc_source *source =3D &desc->sources[i]; - - source->parent =3D desc; + desc->sources =3D g_new0(struct intc_source, nr_sources); + for (i =3D 0; i < nr_sources; i++) { + desc->sources[i].parent =3D desc; } - desc->irqs =3D qemu_allocate_irqs(sh_intc_set_irq, desc, nr_sources); memory_region_init_io(&desc->iomem, NULL, &sh_intc_ops, desc, "intc", 0x100000000ULL); - + j =3D 0; if (desc->mask_regs) { for (i =3D 0; i < desc->nr_mask_regs; i++) { struct intc_mask_reg *mr =3D &desc->mask_regs[i]; --=20 2.31.1