From nobody Fri Sep 12 12:02:32 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=kernel.org ARC-Seal: i=1; a=rsa-sha256; t=1676068107; cv=none; d=zohomail.com; s=zohoarc; b=aXDdSs05uG52uugnpaFuvO12aisZOlwohj2oJhaP8Pe8LsV/yKt666gSEfznQkZaHz0W+eQlA9XMSQrsyr6hAjknny8R/s0kcJF9Wi6zXu7qtZU0CsGP+A3RN4Gac1cSVc4Qk5cZPvCY72VtdI/ELA1Sxkl1P5uoS8B/CbFxjWs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1676068107; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=teDn6xIuYNRmHmixku7ZozIqV1x3VmDQi4gAFRGVlEI=; b=g9SXp8w+zfC/fDP9LK1ShZBukBZgCu5XnOTVhTiRQvqqj5N76dq+ThSr0fdVnaP6EpoLe9SPvOQerw+bbjc+kM73liudmJ2XsESd6m/xGw6BVV5EuWGY/uVWMH/AUlVted7hN0w5tL3T0ykt7uANOUpK0dZ060DFFD0PfWnJCjs= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1676068107670362.5139873546269; Fri, 10 Feb 2023 14:28:27 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pQbrv-0002Hu-Ff; Fri, 10 Feb 2023 17:27:47 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pQbrs-0002GD-Fy for qemu-devel@nongnu.org; Fri, 10 Feb 2023 17:27:44 -0500 Received: from ams.source.kernel.org ([2604:1380:4601:e00::1]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pQbrq-0007jv-9q for qemu-devel@nongnu.org; Fri, 10 Feb 2023 17:27:44 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id CF55CB825FE; Fri, 10 Feb 2023 22:27:40 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D803AC4339B; Fri, 10 Feb 2023 22:27:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1676068060; bh=1muLhh2SpXPFOFywdWq/BvDLZkKQntHqhpnKPhAgHkw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ZEy+Rlx91nk8lCf9WZKthNdDz2CzvVy1LHF0Rv00F8PhG1DbO+Jt+ZWYPsl6XccQ2 7XO+bVlc5eLr5cnaWoFRfKzWy/4N8DOVMsipBkCo1P9gt9Aufb69NuU3+MQKfT7Rfo z1KhL9G4ho0pbjVOr3EaP1pxBsFJ3giKIQ9yEpYuvK76SKKvkBR+6S3J1YDghu69EL f7SR4inBrvU0rnqx65cB1Tu+p5e2QX4tXisIPL7qqYXBnto7RU1Lsl9l7x7eTj76oQ y6tjXNuBRv53aA4MFd8UWDfktTbTEq+bLzV1A5qIgUQsml2wkeon3qSqeIENrv7GUb gDXONsrYq3ryQ== From: Stefano Stabellini To: qemu-devel@nongnu.org Cc: sstabellini@kernel.org, peter.maydell@linaro.org, Vikram Garhwal , Paul Durrant Subject: [PULL 07/10] hw/xen/xen-hvm-common: Use g_new and error_report Date: Fri, 10 Feb 2023 14:27:26 -0800 Message-Id: <20230210222729.957168-7-sstabellini@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2604:1380:4601:e00::1; envelope-from=sstabellini@kernel.org; helo=ams.source.kernel.org X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @kernel.org) X-ZM-MESSAGEID: 1676068109210100003 Content-Type: text/plain; charset="utf-8" From: Vikram Garhwal Replace g_malloc with g_new and perror with error_report. Signed-off-by: Vikram Garhwal Reviewed-by: Stefano Stabellini Reviewed-by: Paul Durrant --- hw/xen/xen-hvm-common.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/hw/xen/xen-hvm-common.c b/hw/xen/xen-hvm-common.c index 5e3c7b073f..077c8dae5b 100644 --- a/hw/xen/xen-hvm-common.c +++ b/hw/xen/xen-hvm-common.c @@ -34,7 +34,7 @@ void xen_ram_alloc(ram_addr_t ram_addr, ram_addr_t size, = MemoryRegion *mr, trace_xen_ram_alloc(ram_addr, size); =20 nr_pfn =3D size >> TARGET_PAGE_BITS; - pfn_list =3D g_malloc(sizeof (*pfn_list) * nr_pfn); + pfn_list =3D g_new(xen_pfn_t, nr_pfn); =20 for (i =3D 0; i < nr_pfn; i++) { pfn_list[i] =3D (ram_addr >> TARGET_PAGE_BITS) + i; @@ -731,7 +731,7 @@ void destroy_hvm_domain(bool reboot) return; } if (errno !=3D ENOTTY /* old Xen */) { - perror("xendevicemodel_shutdown failed"); + error_report("xendevicemodel_shutdown failed with error %d", e= rrno); } /* well, try the old thing then */ } @@ -801,7 +801,7 @@ static void xen_do_ioreq_register(XenIOState *state, } =20 /* Note: cpus is empty at this point in init */ - state->cpu_by_vcpu_id =3D g_malloc0(max_cpus * sizeof(CPUState *)); + state->cpu_by_vcpu_id =3D g_new0(CPUState *, max_cpus); =20 rc =3D xen_set_ioreq_server_state(xen_domid, state->ioservid, true); if (rc < 0) { @@ -810,7 +810,7 @@ static void xen_do_ioreq_register(XenIOState *state, goto err; } =20 - state->ioreq_local_port =3D g_malloc0(max_cpus * sizeof (evtchn_port_t= )); + state->ioreq_local_port =3D g_new0(evtchn_port_t, max_cpus); =20 /* FIXME: how about if we overflow the page here? */ for (i =3D 0; i < max_cpus; i++) { @@ -864,13 +864,13 @@ void xen_register_ioreq(XenIOState *state, unsigned i= nt max_cpus, =20 state->xce_handle =3D xenevtchn_open(NULL, 0); if (state->xce_handle =3D=3D NULL) { - perror("xen: event channel open"); + error_report("xen: event channel open failed with error %d", errno= ); goto err; } =20 state->xenstore =3D xs_daemon_open(); if (state->xenstore =3D=3D NULL) { - perror("xen: xenstore open"); + error_report("xen: xenstore open failed with error %d", errno); goto err; } =20 --=20 2.25.1