From nobody Sun Feb 8 21:09:29 2026 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=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1663936173; cv=none; d=zohomail.com; s=zohoarc; b=EM/oeX5K4u4fRoeoP0wgJBeHj3F7hksQqGQYKmi0FgR7Wz6P4KjxOaho9HRx6R2uAx2cb4YEDGBM4q4x3+Z57HrY+eY4x6qdu4KVwIYJwsN2Vo6elSsQt0ObQ/raNUyp1k09yxVa95tZ5g/zZNoXHdfq3m6PGliK5Hy+wYYHB18= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1663936173; h=Content-Type: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=M7P9/8xejzoLZcu/tfGY2sj5CXpWf4HB6MWxdifYEUc=; b=RchAGFPwKSkH2WB4YkH0+Ji0Dm1HnFXJd1F7LO0w14iNP3G6erGVhPSBf42b+kwkQOIGP3qVXO1k/emVJBKadPELGjcGan+7ME4N3b/aAv6lE8O+IKZgfgEdZVQqbflVKF79yG25YroQcKZjALyVl/5iRAPCnvmplOUMWUB9jwk= 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 1663936173060393.52757984989387; Fri, 23 Sep 2022 05:29:33 -0700 (PDT) Received: from localhost ([::1]:44040 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1obhoB-0002Nz-PC for importer@patchew.org; Fri, 23 Sep 2022 08:29:31 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:37940) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1obhME-0001ls-St for qemu-devel@nongnu.org; Fri, 23 Sep 2022 08:00:44 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:55751) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1obhMC-0000FF-3d for qemu-devel@nongnu.org; Fri, 23 Sep 2022 08:00:38 -0400 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-360-c6HX2ZJAMxerV-Q3dGna6Q-1; Fri, 23 Sep 2022 08:00:27 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 86299800186; Fri, 23 Sep 2022 12:00:27 +0000 (UTC) Received: from blackfin.pond.sub.org (unknown [10.39.192.163]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 58C05140EBF3; Fri, 23 Sep 2022 12:00:27 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id 24D3F21E6901; Fri, 23 Sep 2022 14:00:25 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1663934435; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=M7P9/8xejzoLZcu/tfGY2sj5CXpWf4HB6MWxdifYEUc=; b=ApCsHI80JTI1SK8kFREWJzS65Iw8vYBOPM2d/wwEFHFZZKoisR+FWf43sL0DBaxGvKw+v5 D1QQ99bpYWx6O3gpUoDL23SXH1LTUpbWy6CA9pbmagiv06N3g8V4tciXorn9sc1tfemSV/ Xr5leIasdh6VwgHjHz9pE8vVx5589bA= X-MC-Unique: c6HX2ZJAMxerV-Q3dGna6Q-1 From: Markus Armbruster To: qemu-devel@nongnu.org Cc: qemu-trivial@nongnu.org Subject: [PATCH 1/3] hw/core: Tidy up unnecessary casting away of const Date: Fri, 23 Sep 2022 14:00:23 +0200 Message-Id: <20220923120025.448759-2-armbru@redhat.com> In-Reply-To: <20220923120025.448759-1-armbru@redhat.com> References: <20220923120025.448759-1-armbru@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.7 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=170.10.133.124; envelope-from=armbru@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 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_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable 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" X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1663936174630100001 Content-Type: text/plain; charset="utf-8" Signed-off-by: Markus Armbruster Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- hw/core/sysbus-fdt.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/hw/core/sysbus-fdt.c b/hw/core/sysbus-fdt.c index edb0c49b19..eebcd28f9a 100644 --- a/hw/core/sysbus-fdt.c +++ b/hw/core/sysbus-fdt.c @@ -299,7 +299,8 @@ static int add_amd_xgbe_fdt_node(SysBusDevice *sbdev, v= oid *opaque) void *guest_fdt =3D data->fdt, *host_fdt; const void *r; int i, prop_len; - uint32_t *irq_attr, *reg_attr, *host_clock_phandles; + uint32_t *irq_attr, *reg_attr; + const uint32_t *host_clock_phandles; uint64_t mmio_base, irq_number; uint32_t guest_clock_phandles[2]; =20 @@ -339,7 +340,7 @@ static int add_amd_xgbe_fdt_node(SysBusDevice *sbdev, v= oid *opaque) error_report("%s clocks property should contain 2 handles", __func= __); exit(1); } - host_clock_phandles =3D (uint32_t *)r; + host_clock_phandles =3D r; guest_clock_phandles[0] =3D qemu_fdt_alloc_phandle(guest_fdt); guest_clock_phandles[1] =3D qemu_fdt_alloc_phandle(guest_fdt); =20 --=20 2.37.2 From nobody Sun Feb 8 21:09:29 2026 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=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1663935259; cv=none; d=zohomail.com; s=zohoarc; b=J3/Jc5zmuL+NR41lVH5wysvUF2PRmHqxpQDoGfeTXTP5g1EbrtddT+3OUtuGSHw1LZfd6RdemQirgjRJStmBrWpB4s0B+Op6Yj6IW9kQuDa2xjUUabwMHtLcE1vJrXQFzFqZUlwJamDOgMVi6u7sMMpc7eVzwDKXr4W70Yn1aS4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1663935259; h=Content-Type: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=qKD5dj5BRbB/dUJ9ghUyxSIdmCnlPxmqIrhKCIATiRM=; b=dXoeAn8/7LKinG8z+BAKmL8Kf3FGXFAy5pc+DWpVYxjjZKL6/h8UNrVNRrm8mZI1qf8S222qsKke0bAe3w1+3aCm0M+2OReqiaqNS6r+Tu5C5U3YhNrF4+nYvhFlJFvwqk+g5sELGLHWY/nty5TVExaIc46nBHoN4hU0mXvKwCQ= 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 1663935259636649.4854034756031; Fri, 23 Sep 2022 05:14:19 -0700 (PDT) Received: from localhost ([::1]:49358 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1obhZS-0001ri-JB for importer@patchew.org; Fri, 23 Sep 2022 08:14:18 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:40984) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1obhMA-0001gy-P7 for qemu-devel@nongnu.org; Fri, 23 Sep 2022 08:00:34 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:40565) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1obhM8-0000Cn-37 for qemu-devel@nongnu.org; Fri, 23 Sep 2022 08:00:34 -0400 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-380-JcE96BXGMQiG8MwW8D2Zvw-1; Fri, 23 Sep 2022 08:00:28 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id ACE8386865C; Fri, 23 Sep 2022 12:00:27 +0000 (UTC) Received: from blackfin.pond.sub.org (unknown [10.39.192.163]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 58E20C15BB9; Fri, 23 Sep 2022 12:00:27 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id 2746121E691D; Fri, 23 Sep 2022 14:00:25 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1663934431; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=qKD5dj5BRbB/dUJ9ghUyxSIdmCnlPxmqIrhKCIATiRM=; b=YYPcQTR29/ob1hkfQuxWd7/vCTnAHm7c77zGTvg2lMBPj78JZ4BFIKqgyPrXubBuykjWYO JZs9AGDdCV7we9WkOMlnJy7+LUiOvq484rgx57QkwMZyUXy769cmo7weCUm9CFIPLky7xB gbR6eTtuegjsxZ3AaorvFcBlorVPFes= X-MC-Unique: JcE96BXGMQiG8MwW8D2Zvw-1 From: Markus Armbruster To: qemu-devel@nongnu.org Cc: qemu-trivial@nongnu.org Subject: [PATCH 2/3] Drop useless casts from g_malloc() & friends to pointer Date: Fri, 23 Sep 2022 14:00:24 +0200 Message-Id: <20220923120025.448759-3-armbru@redhat.com> In-Reply-To: <20220923120025.448759-1-armbru@redhat.com> References: <20220923120025.448759-1-armbru@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.8 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=170.10.133.124; envelope-from=armbru@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 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_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable 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" X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1663935261322100001 Content-Type: text/plain; charset="utf-8" These memory allocation functions return void *, and casting to another pointer type is useless clutter. Drop these casts. If you really want another pointer type, consider g_new(). Signed-off-by: Markus Armbruster Reviewed-by: Laurent Vivier --- hw/arm/nseries.c | 4 ++-- hw/char/exynos4210_uart.c | 2 +- hw/display/blizzard.c | 2 +- hw/misc/cbus.c | 6 +++--- hw/nvram/eeprom93xx.c | 2 +- hw/usb/ccid-card-emulated.c | 2 +- target/i386/kvm/kvm.c | 3 +-- target/i386/whpx/whpx-all.c | 5 ++--- target/s390x/kvm/kvm.c | 2 +- ui/vnc-enc-hextile.c | 4 ++-- 10 files changed, 15 insertions(+), 17 deletions(-) diff --git a/hw/arm/nseries.c b/hw/arm/nseries.c index 692c94ceb4..b151113c27 100644 --- a/hw/arm/nseries.c +++ b/hw/arm/nseries.c @@ -702,7 +702,7 @@ static uint32_t mipid_txrx(void *opaque, uint32_t cmd, = int len) =20 static void *mipid_init(void) { - struct mipid_s *s =3D (struct mipid_s *) g_malloc0(sizeof(*s)); + struct mipid_s *s =3D g_malloc0(sizeof(*s)); =20 s->id =3D 0x838f03; mipid_reset(s); @@ -1300,7 +1300,7 @@ static int n810_atag_setup(const struct arm_boot_info= *info, void *p) static void n8x0_init(MachineState *machine, struct arm_boot_info *binfo, int model) { - struct n800_s *s =3D (struct n800_s *) g_malloc0(sizeof(*s)); + struct n800_s *s =3D g_malloc0(sizeof(*s)); MachineClass *mc =3D MACHINE_GET_CLASS(machine); =20 if (machine->ram_size !=3D mc->default_ram_size) { diff --git a/hw/char/exynos4210_uart.c b/hw/char/exynos4210_uart.c index addcd59b02..7b7c56b6ef 100644 --- a/hw/char/exynos4210_uart.c +++ b/hw/char/exynos4210_uart.c @@ -211,7 +211,7 @@ static void fifo_reset(Exynos4210UartFIFO *q) g_free(q->data); q->data =3D NULL; =20 - q->data =3D (uint8_t *)g_malloc0(q->size); + q->data =3D g_malloc0(q->size); =20 q->sp =3D 0; q->rp =3D 0; diff --git a/hw/display/blizzard.c b/hw/display/blizzard.c index 105241577d..ebe230dd0a 100644 --- a/hw/display/blizzard.c +++ b/hw/display/blizzard.c @@ -1007,7 +1007,7 @@ static const GraphicHwOps blizzard_ops =3D { =20 void *s1d13745_init(qemu_irq gpio_int) { - BlizzardState *s =3D (BlizzardState *) g_malloc0(sizeof(*s)); + BlizzardState *s =3D g_malloc0(sizeof(*s)); DisplaySurface *surface; =20 s->fb =3D g_malloc(0x180000); diff --git a/hw/misc/cbus.c b/hw/misc/cbus.c index 3c3721ad2d..653e8ddcd5 100644 --- a/hw/misc/cbus.c +++ b/hw/misc/cbus.c @@ -133,7 +133,7 @@ static void cbus_sel(void *opaque, int line, int level) =20 CBus *cbus_init(qemu_irq dat) { - CBusPriv *s =3D (CBusPriv *) g_malloc0(sizeof(*s)); + CBusPriv *s =3D g_malloc0(sizeof(*s)); =20 s->dat_out =3D dat; s->cbus.clk =3D qemu_allocate_irq(cbus_clk, s, 0); @@ -388,7 +388,7 @@ static void retu_io(void *opaque, int rw, int reg, uint= 16_t *val) =20 void *retu_init(qemu_irq irq, int vilma) { - CBusRetu *s =3D (CBusRetu *) g_malloc0(sizeof(*s)); + CBusRetu *s =3D g_malloc0(sizeof(*s)); =20 s->irq =3D irq; s->irqen =3D 0xffff; @@ -604,7 +604,7 @@ static void tahvo_io(void *opaque, int rw, int reg, uin= t16_t *val) =20 void *tahvo_init(qemu_irq irq, int betty) { - CBusTahvo *s =3D (CBusTahvo *) g_malloc0(sizeof(*s)); + CBusTahvo *s =3D g_malloc0(sizeof(*s)); =20 s->irq =3D irq; s->irqen =3D 0xffff; diff --git a/hw/nvram/eeprom93xx.c b/hw/nvram/eeprom93xx.c index a1b9c78844..1081e2cc0d 100644 --- a/hw/nvram/eeprom93xx.c +++ b/hw/nvram/eeprom93xx.c @@ -315,7 +315,7 @@ eeprom_t *eeprom93xx_new(DeviceState *dev, uint16_t nwo= rds) addrbits =3D 6; } =20 - eeprom =3D (eeprom_t *)g_malloc0(sizeof(*eeprom) + nwords * 2); + eeprom =3D g_malloc0(sizeof(*eeprom) + nwords * 2); eeprom->size =3D nwords; eeprom->addrbits =3D addrbits; /* Output DO is tristate, read results in 1. */ diff --git a/hw/usb/ccid-card-emulated.c b/hw/usb/ccid-card-emulated.c index 1ddf7297f6..ee41a81801 100644 --- a/hw/usb/ccid-card-emulated.c +++ b/hw/usb/ccid-card-emulated.c @@ -140,7 +140,7 @@ static void emulated_apdu_from_guest(CCIDCardState *bas= e, const uint8_t *apdu, uint32_t len) { EmulatedState *card =3D EMULATED_CCID_CARD(base); - EmulEvent *event =3D (EmulEvent *)g_malloc(sizeof(EmulEvent) + len); + EmulEvent *event =3D g_malloc(sizeof(EmulEvent) + len); =20 assert(event); event->p.data.type =3D EMUL_GUEST_APDU; diff --git a/target/i386/kvm/kvm.c b/target/i386/kvm/kvm.c index a1fd1f5379..c8f4d500ea 100644 --- a/target/i386/kvm/kvm.c +++ b/target/i386/kvm/kvm.c @@ -2252,8 +2252,7 @@ static int kvm_get_supported_feature_msrs(KVMState *s) } =20 assert(msr_list.nmsrs > 0); - kvm_feature_msrs =3D (struct kvm_msr_list *) \ - g_malloc0(sizeof(msr_list) + + kvm_feature_msrs =3D g_malloc0(sizeof(msr_list) + msr_list.nmsrs * sizeof(msr_list.indices[0])); =20 kvm_feature_msrs->nmsrs =3D msr_list.nmsrs; diff --git a/target/i386/whpx/whpx-all.c b/target/i386/whpx/whpx-all.c index b22a3314b4..fbb728a36f 100644 --- a/target/i386/whpx/whpx-all.c +++ b/target/i386/whpx/whpx-all.c @@ -1164,9 +1164,8 @@ static void whpx_translate_cpu_breakpoints( (breakpoints->breakpoints ? breakpoints->breakpoints->used : 0); =20 struct whpx_breakpoint_collection *new_breakpoints =3D - (struct whpx_breakpoint_collection *)g_malloc0( - sizeof(struct whpx_breakpoint_collection) + - max_breakpoints * sizeof(struct whpx_breakpoint)); + g_malloc0(sizeof(struct whpx_breakpoint_collection) + + max_breakpoints * sizeof(struct whpx_breakpoint)); =20 new_breakpoints->allocated =3D max_breakpoints; new_breakpoints->used =3D 0; diff --git a/target/s390x/kvm/kvm.c b/target/s390x/kvm/kvm.c index 7bd8db0e7b..32d23fb617 100644 --- a/target/s390x/kvm/kvm.c +++ b/target/s390x/kvm/kvm.c @@ -1031,7 +1031,7 @@ int kvm_arch_remove_hw_breakpoint(target_ulong addr, } size =3D nb_hw_breakpoints * sizeof(struct kvm_hw_breakpoint); hw_breakpoints =3D - (struct kvm_hw_breakpoint *)g_realloc(hw_breakpoints, size); + g_realloc(hw_breakpoints, size); } else { g_free(hw_breakpoints); hw_breakpoints =3D NULL; diff --git a/ui/vnc-enc-hextile.c b/ui/vnc-enc-hextile.c index 4215bd7daf..c763256f29 100644 --- a/ui/vnc-enc-hextile.c +++ b/ui/vnc-enc-hextile.c @@ -50,8 +50,8 @@ int vnc_hextile_send_framebuffer_update(VncState *vs, int= x, int has_fg, has_bg; uint8_t *last_fg, *last_bg; =20 - last_fg =3D (uint8_t *) g_malloc(VNC_SERVER_FB_BYTES); - last_bg =3D (uint8_t *) g_malloc(VNC_SERVER_FB_BYTES); + last_fg =3D g_malloc(VNC_SERVER_FB_BYTES); + last_bg =3D g_malloc(VNC_SERVER_FB_BYTES); has_fg =3D has_bg =3D 0; for (j =3D y; j < (y + h); j +=3D 16) { for (i =3D x; i < (x + w); i +=3D 16) { --=20 2.37.2 From nobody Sun Feb 8 21:09:29 2026 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=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1663935385; cv=none; d=zohomail.com; s=zohoarc; b=cW/19FaEhQVNxWKWRLLNqnUr6MBvnC5OAblgPuZRocHml51Igql4P+q8/+SSfJsjsYNMXDd42eUGs0XS6fuZo88QaY0RwipPd9UX3SJ+gubFAKQva6Brwsj7Jx0tOtDuZUwPDEkFO0/uJ17PBCeLVONMk3J2ZIOcr6MWa3UXMQs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1663935385; h=Content-Type: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=lMOeNKiKmnBVl5QQvfhoGvxuoatTGCNJ+2hvCx8kZ0s=; b=O1vT2ScZgZfN0+gP849R3eJw9IzEv0xFcg7QF0N5mJwmV8rX7Ms04vaWdqmmWEoP+bEUBj7KtW/up2gRhto+EaOMmFft2y6bDt44NGr49BcOF+kIwzOPhm7el1SPsz4KZe1ilvY9gaAoypPQiFbGpKgV7LsfNZ4Nxi6VqvFb7T8= 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 166393538520089.88532616004625; Fri, 23 Sep 2022 05:16:25 -0700 (PDT) Received: from localhost ([::1]:52856 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1obhbU-0003sQ-04 for importer@patchew.org; Fri, 23 Sep 2022 08:16:24 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:40978) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1obhM9-0001ei-0C for qemu-devel@nongnu.org; Fri, 23 Sep 2022 08:00:33 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:37027) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1obhM6-0000AD-Bs for qemu-devel@nongnu.org; Fri, 23 Sep 2022 08:00:32 -0400 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-394-qd_AufYINuCzTF5cjlpzqg-1; Fri, 23 Sep 2022 08:00:28 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id CFDE0801231; Fri, 23 Sep 2022 12:00:27 +0000 (UTC) Received: from blackfin.pond.sub.org (unknown [10.39.192.163]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 58B891121325; Fri, 23 Sep 2022 12:00:27 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id 29C5821E6928; Fri, 23 Sep 2022 14:00:25 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1663934429; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=lMOeNKiKmnBVl5QQvfhoGvxuoatTGCNJ+2hvCx8kZ0s=; b=P6nguFTxNoX0Igvgh1hPKbh+LMMTjkc3JcmsxNCcpfFN9jg64mVBihzgYJYD6muGQhAw1c /qqSOKjR1UWqtSBYIpfhpHjgtL7Gmq+TZ1GANNxB4ZhTa8+eexxNAoZSW4av+y2BNYgkHV o2w7mD0E6/7CfVJ+Q4p4aVLJWvIZm2k= X-MC-Unique: qd_AufYINuCzTF5cjlpzqg-1 From: Markus Armbruster To: qemu-devel@nongnu.org Cc: qemu-trivial@nongnu.org Subject: [PATCH 3/3] Drop more useless casts from void * to pointer Date: Fri, 23 Sep 2022 14:00:25 +0200 Message-Id: <20220923120025.448759-4-armbru@redhat.com> In-Reply-To: <20220923120025.448759-1-armbru@redhat.com> References: <20220923120025.448759-1-armbru@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.3 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=170.10.133.124; envelope-from=armbru@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 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_LOW=-0.7, 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" X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1663935386547100001 Content-Type: text/plain; charset="utf-8" Signed-off-by: Markus Armbruster Reviewed-by: Laurent Vivier --- bsd-user/elfload.c | 2 +- contrib/plugins/cache.c | 8 ++++---- contrib/vhost-user-blk/vhost-user-blk.c | 2 +- hw/core/qdev-clock.c | 2 +- hw/hyperv/vmbus.c | 2 +- hw/net/cadence_gem.c | 2 +- hw/net/virtio-net.c | 2 +- hw/nvme/ctrl.c | 4 ++-- hw/rdma/vmw/pvrdma_cmd.c | 9 +++------ hw/rdma/vmw/pvrdma_qp_ops.c | 6 +++--- hw/virtio/virtio-iommu.c | 3 +-- linux-user/syscall.c | 2 +- target/i386/hax/hax-all.c | 2 +- tests/tcg/aarch64/system/semiheap.c | 4 ++-- util/coroutine-ucontext.c | 2 +- util/vfio-helpers.c | 2 +- 16 files changed, 25 insertions(+), 29 deletions(-) diff --git a/bsd-user/elfload.c b/bsd-user/elfload.c index f8edb22f2a..fbcdc94b96 100644 --- a/bsd-user/elfload.c +++ b/bsd-user/elfload.c @@ -156,7 +156,7 @@ static abi_ulong copy_elf_strings(int argc, char **argv= , void **page, --p; --tmp; --len; if (--offset < 0) { offset =3D p % TARGET_PAGE_SIZE; - pag =3D (char *)page[p / TARGET_PAGE_SIZE]; + pag =3D page[p / TARGET_PAGE_SIZE]; if (!pag) { pag =3D g_try_malloc0(TARGET_PAGE_SIZE); page[p / TARGET_PAGE_SIZE] =3D pag; diff --git a/contrib/plugins/cache.c b/contrib/plugins/cache.c index ac1510aaa1..2e25184a7f 100644 --- a/contrib/plugins/cache.c +++ b/contrib/plugins/cache.c @@ -405,7 +405,7 @@ static void vcpu_mem_access(unsigned int vcpu_index, qe= mu_plugin_meminfo_t info, g_mutex_lock(&l1_dcache_locks[cache_idx]); hit_in_l1 =3D access_cache(l1_dcaches[cache_idx], effective_addr); if (!hit_in_l1) { - insn =3D (InsnData *) userdata; + insn =3D userdata; __atomic_fetch_add(&insn->l1_dmisses, 1, __ATOMIC_SEQ_CST); l1_dcaches[cache_idx]->misses++; } @@ -419,7 +419,7 @@ static void vcpu_mem_access(unsigned int vcpu_index, qe= mu_plugin_meminfo_t info, =20 g_mutex_lock(&l2_ucache_locks[cache_idx]); if (!access_cache(l2_ucaches[cache_idx], effective_addr)) { - insn =3D (InsnData *) userdata; + insn =3D userdata; __atomic_fetch_add(&insn->l2_misses, 1, __ATOMIC_SEQ_CST); l2_ucaches[cache_idx]->misses++; } @@ -440,7 +440,7 @@ static void vcpu_insn_exec(unsigned int vcpu_index, voi= d *userdata) g_mutex_lock(&l1_icache_locks[cache_idx]); hit_in_l1 =3D access_cache(l1_icaches[cache_idx], insn_addr); if (!hit_in_l1) { - insn =3D (InsnData *) userdata; + insn =3D userdata; __atomic_fetch_add(&insn->l1_imisses, 1, __ATOMIC_SEQ_CST); l1_icaches[cache_idx]->misses++; } @@ -454,7 +454,7 @@ static void vcpu_insn_exec(unsigned int vcpu_index, voi= d *userdata) =20 g_mutex_lock(&l2_ucache_locks[cache_idx]); if (!access_cache(l2_ucaches[cache_idx], insn_addr)) { - insn =3D (InsnData *) userdata; + insn =3D userdata; __atomic_fetch_add(&insn->l2_misses, 1, __ATOMIC_SEQ_CST); l2_ucaches[cache_idx]->misses++; } diff --git a/contrib/vhost-user-blk/vhost-user-blk.c b/contrib/vhost-user-b= lk/vhost-user-blk.c index d6932a2645..aa99877fcd 100644 --- a/contrib/vhost-user-blk/vhost-user-blk.c +++ b/contrib/vhost-user-blk/vhost-user-blk.c @@ -193,7 +193,7 @@ vub_discard_write_zeroes(VubReq *req, struct iovec *iov= , uint32_t iovcnt, =20 #if defined(__linux__) && defined(BLKDISCARD) && defined(BLKZEROOUT) VubDev *vdev_blk =3D req->vdev_blk; - desc =3D (struct virtio_blk_discard_write_zeroes *)buf; + desc =3D buf; uint64_t range[2] =3D { le64toh(desc->sector) << 9, le32toh(desc->num_sectors) << 9 }; if (type =3D=3D VIRTIO_BLK_T_DISCARD) { diff --git a/hw/core/qdev-clock.c b/hw/core/qdev-clock.c index 117f4c6ea4..82799577f3 100644 --- a/hw/core/qdev-clock.c +++ b/hw/core/qdev-clock.c @@ -134,7 +134,7 @@ void qdev_init_clocks(DeviceState *dev, const ClockPort= InitArray clocks) Clock **clkp; /* offset cannot be inside the DeviceState part */ assert(elem->offset > sizeof(DeviceState)); - clkp =3D (Clock **)(((void *) dev) + elem->offset); + clkp =3D ((void *)dev) + elem->offset; if (elem->is_output) { *clkp =3D qdev_init_clock_out(dev, elem->name); } else { diff --git a/hw/hyperv/vmbus.c b/hw/hyperv/vmbus.c index 30bc04e1c4..f956381cc9 100644 --- a/hw/hyperv/vmbus.c +++ b/hw/hyperv/vmbus.c @@ -2104,7 +2104,7 @@ static void process_message(VMBus *vmbus) goto out; } msgdata =3D hv_msg->payload; - msg =3D (struct vmbus_message_header *)msgdata; + msg =3D msgdata; =20 trace_vmbus_process_incoming_message(msg->message_type); =20 diff --git a/hw/net/cadence_gem.c b/hw/net/cadence_gem.c index 24b3a0ff66..42ea2411a2 100644 --- a/hw/net/cadence_gem.c +++ b/hw/net/cadence_gem.c @@ -1429,7 +1429,7 @@ static uint64_t gem_read(void *opaque, hwaddr offset,= unsigned size) { CadenceGEMState *s; uint32_t retval; - s =3D (CadenceGEMState *)opaque; + s =3D opaque; =20 offset >>=3D 2; retval =3D s->regs[offset]; diff --git a/hw/net/virtio-net.c b/hw/net/virtio-net.c index dd0d056fde..3cb4dd8f5d 100644 --- a/hw/net/virtio-net.c +++ b/hw/net/virtio-net.c @@ -2414,7 +2414,7 @@ static size_t virtio_net_rsc_receive6(void *opq, NetC= lientState *nc, VirtioNetRscChain *chain; VirtioNetRscUnit unit; =20 - chain =3D (VirtioNetRscChain *)opq; + chain =3D opq; hdr_len =3D ((VirtIONet *)(chain->n))->guest_hdr_len; =20 if (size < (hdr_len + sizeof(struct eth_header) + sizeof(struct ip6_he= ader) diff --git a/hw/nvme/ctrl.c b/hw/nvme/ctrl.c index 87aeba0564..43d305539b 100644 --- a/hw/nvme/ctrl.c +++ b/hw/nvme/ctrl.c @@ -4109,14 +4109,14 @@ static uint16_t nvme_zone_mgmt_recv(NvmeCtrl *n, Nv= meRequest *req) nr_zones++; } } - header =3D (NvmeZoneReportHeader *)buf; + header =3D buf; header->nr_zones =3D cpu_to_le64(nr_zones); =20 buf_p =3D buf + sizeof(NvmeZoneReportHeader); for (; zone_idx < ns->num_zones && max_zones > 0; zone_idx++) { zone =3D &ns->zone_array[zone_idx]; if (nvme_zone_matches_filter(zrasf, zone)) { - z =3D (NvmeZoneDescr *)buf_p; + z =3D buf_p; buf_p +=3D sizeof(NvmeZoneDescr); =20 z->zt =3D zone->d.zt; diff --git a/hw/rdma/vmw/pvrdma_cmd.c b/hw/rdma/vmw/pvrdma_cmd.c index da7ddfa548..f5b6c3d728 100644 --- a/hw/rdma/vmw/pvrdma_cmd.c +++ b/hw/rdma/vmw/pvrdma_cmd.c @@ -269,8 +269,7 @@ static int create_cq_ring(PCIDevice *pci_dev , PvrdmaRi= ng **ring, r =3D g_malloc(sizeof(*r)); *ring =3D r; =20 - r->ring_state =3D (PvrdmaRingState *) - rdma_pci_dma_map(pci_dev, tbl[0], TARGET_PAGE_SIZE); + r->ring_state =3D rdma_pci_dma_map(pci_dev, tbl[0], TARGET_PAGE_SIZE); =20 if (!r->ring_state) { rdma_error_report("Failed to map to CQ ring state"); @@ -405,8 +404,7 @@ static int create_qp_rings(PCIDevice *pci_dev, uint64_t= pdir_dma, *rings =3D sr; =20 /* Create send ring */ - sr->ring_state =3D (PvrdmaRingState *) - rdma_pci_dma_map(pci_dev, tbl[0], TARGET_PAGE_SIZE); + sr->ring_state =3D rdma_pci_dma_map(pci_dev, tbl[0], TARGET_PAGE_SIZE); if (!sr->ring_state) { rdma_error_report("Failed to map to QP ring state"); goto out_free_sr_mem; @@ -646,8 +644,7 @@ static int create_srq_ring(PCIDevice *pci_dev, PvrdmaRi= ng **ring, r =3D g_malloc(sizeof(*r)); *ring =3D r; =20 - r->ring_state =3D (PvrdmaRingState *) - rdma_pci_dma_map(pci_dev, tbl[0], TARGET_PAGE_SIZE); + r->ring_state =3D rdma_pci_dma_map(pci_dev, tbl[0], TARGET_PAGE_SIZE); if (!r->ring_state) { rdma_error_report("Failed to map tp SRQ ring state"); goto out_free_ring_mem; diff --git a/hw/rdma/vmw/pvrdma_qp_ops.c b/hw/rdma/vmw/pvrdma_qp_ops.c index bd7cbf2bdf..c30c8344f6 100644 --- a/hw/rdma/vmw/pvrdma_qp_ops.c +++ b/hw/rdma/vmw/pvrdma_qp_ops.c @@ -149,7 +149,7 @@ void pvrdma_qp_send(PVRDMADev *dev, uint32_t qp_handle) =20 ring =3D (PvrdmaRing *)qp->opaque; =20 - wqe =3D (struct PvrdmaSqWqe *)pvrdma_ring_next_elem_read(ring); + wqe =3D pvrdma_ring_next_elem_read(ring); while (wqe) { CompHandlerCtx *comp_ctx; =20 @@ -212,7 +212,7 @@ void pvrdma_qp_recv(PVRDMADev *dev, uint32_t qp_handle) =20 ring =3D &((PvrdmaRing *)qp->opaque)[1]; =20 - wqe =3D (struct PvrdmaRqWqe *)pvrdma_ring_next_elem_read(ring); + wqe =3D pvrdma_ring_next_elem_read(ring); while (wqe) { CompHandlerCtx *comp_ctx; =20 @@ -254,7 +254,7 @@ void pvrdma_srq_recv(PVRDMADev *dev, uint32_t srq_handl= e) =20 ring =3D (PvrdmaRing *)srq->opaque; =20 - wqe =3D (struct PvrdmaRqWqe *)pvrdma_ring_next_elem_read(ring); + wqe =3D pvrdma_ring_next_elem_read(ring); while (wqe) { CompHandlerCtx *comp_ctx; =20 diff --git a/hw/virtio/virtio-iommu.c b/hw/virtio/virtio-iommu.c index 62e07ec2e4..23c470977e 100644 --- a/hw/virtio/virtio-iommu.c +++ b/hw/virtio/virtio-iommu.c @@ -775,8 +775,7 @@ static void virtio_iommu_handle_command(VirtIODevice *v= dev, VirtQueue *vq) output_size =3D s->config.probe_size + sizeof(tail); buf =3D g_malloc0(output_size); =20 - ptail =3D (struct virtio_iommu_req_tail *) - (buf + s->config.probe_size); + ptail =3D buf + s->config.probe_size; ptail->status =3D virtio_iommu_handle_probe(s, iov, iov_cnt, b= uf); break; } diff --git a/linux-user/syscall.c b/linux-user/syscall.c index f409121202..d27f78f0c8 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -5422,7 +5422,7 @@ static abi_long do_ioctl_rt(const IOCTLEntry *ie, uin= t8_t *buf_temp, for (i =3D 0; i < se->nb_fields; i++) { if (dst_offsets[i] =3D=3D offsetof(struct rtentry, rt_dev)) { assert(*field_types =3D=3D TYPE_PTRVOID); - target_rt_dev_ptr =3D (abi_ulong *)(argptr + src_offsets[i]); + target_rt_dev_ptr =3D argptr + src_offsets[i]; host_rt_dev_ptr =3D (unsigned long *)(buf_temp + dst_offsets[i= ]); if (*target_rt_dev_ptr !=3D 0) { *host_rt_dev_ptr =3D (unsigned long)lock_user_string( diff --git a/target/i386/hax/hax-all.c b/target/i386/hax/hax-all.c index b185ee8de4..b7fb5385b2 100644 --- a/target/i386/hax/hax-all.c +++ b/target/i386/hax/hax-all.c @@ -388,7 +388,7 @@ static int hax_handle_io(CPUArchState *env, uint32_t df= , uint16_t port, MemTxAttrs attrs =3D { 0 }; =20 if (!df) { - ptr =3D (uint8_t *) buffer; + ptr =3D buffer; } else { ptr =3D buffer + size * count - size; } diff --git a/tests/tcg/aarch64/system/semiheap.c b/tests/tcg/aarch64/system= /semiheap.c index a254bd8982..693a1b037d 100644 --- a/tests/tcg/aarch64/system/semiheap.c +++ b/tests/tcg/aarch64/system/semiheap.c @@ -73,11 +73,11 @@ int main(int argc, char *argv[argc]) ml_printf("stack: %p <- %p\n", info.stack_limit, info.stack_base); =20 /* finally can we read/write the heap */ - ptr_to_heap =3D (uint32_t *) info.heap_base; + ptr_to_heap =3D info.heap_base; for (i =3D 0; i < 512; i++) { *ptr_to_heap++ =3D i; } - ptr_to_heap =3D (uint32_t *) info.heap_base; + ptr_to_heap =3D info.heap_base; for (i =3D 0; i < 512; i++) { uint32_t tmp =3D *ptr_to_heap; if (tmp !=3D i) { diff --git a/util/coroutine-ucontext.c b/util/coroutine-ucontext.c index ddc98fb4f8..31f586d366 100644 --- a/util/coroutine-ucontext.c +++ b/util/coroutine-ucontext.c @@ -105,7 +105,7 @@ void finish_switch_fiber(void *fake_stack_save) __sanitizer_finish_switch_fiber(fake_stack_save, &bottom_old, &size_ol= d); =20 if (!leaderp->stack) { - leaderp->stack =3D (void *)bottom_old; + leaderp->stack =3D bottom_old; leaderp->stack_size =3D size_old; } #endif diff --git a/util/vfio-helpers.c b/util/vfio-helpers.c index 5ba01177bf..b8eb132807 100644 --- a/util/vfio-helpers.c +++ b/util/vfio-helpers.c @@ -271,7 +271,7 @@ static void collect_usable_iova_ranges(QEMUVFIOState *s= , void *buf) if (!cap->next) { return; } - cap =3D (struct vfio_info_cap_header *)(buf + cap->next); + cap =3D buf + cap->next; } =20 cap_iova_range =3D (struct vfio_iommu_type1_info_cap_iova_range *)cap; --=20 2.37.2