qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/3] Drop useless casts from void * to pointer
@ 2022-09-23 12:00 Markus Armbruster
  2022-09-23 12:00 ` [PATCH 1/3] hw/core: Tidy up unnecessary casting away of const Markus Armbruster
                   ` (3 more replies)
  0 siblings, 4 replies; 11+ messages in thread
From: Markus Armbruster @ 2022-09-23 12:00 UTC (permalink / raw)
  To: qemu-devel; +Cc: qemu-trivial

Markus Armbruster (3):
  hw/core: Tidy up unnecessary casting away of const
  Drop useless casts from g_malloc() & friends to pointer
  Drop more useless casts from void * to pointer

 bsd-user/elfload.c                      | 2 +-
 contrib/plugins/cache.c                 | 8 ++++----
 contrib/vhost-user-blk/vhost-user-blk.c | 2 +-
 hw/arm/nseries.c                        | 4 ++--
 hw/char/exynos4210_uart.c               | 2 +-
 hw/core/qdev-clock.c                    | 2 +-
 hw/core/sysbus-fdt.c                    | 5 +++--
 hw/display/blizzard.c                   | 2 +-
 hw/hyperv/vmbus.c                       | 2 +-
 hw/misc/cbus.c                          | 6 +++---
 hw/net/cadence_gem.c                    | 2 +-
 hw/net/virtio-net.c                     | 2 +-
 hw/nvme/ctrl.c                          | 4 ++--
 hw/nvram/eeprom93xx.c                   | 2 +-
 hw/rdma/vmw/pvrdma_cmd.c                | 9 +++------
 hw/rdma/vmw/pvrdma_qp_ops.c             | 6 +++---
 hw/usb/ccid-card-emulated.c             | 2 +-
 hw/virtio/virtio-iommu.c                | 3 +--
 linux-user/syscall.c                    | 2 +-
 target/i386/hax/hax-all.c               | 2 +-
 target/i386/kvm/kvm.c                   | 3 +--
 target/i386/whpx/whpx-all.c             | 5 ++---
 target/s390x/kvm/kvm.c                  | 2 +-
 tests/tcg/aarch64/system/semiheap.c     | 4 ++--
 ui/vnc-enc-hextile.c                    | 4 ++--
 util/coroutine-ucontext.c               | 2 +-
 util/vfio-helpers.c                     | 2 +-
 27 files changed, 43 insertions(+), 48 deletions(-)

-- 
2.37.2



^ permalink raw reply	[flat|nested] 11+ messages in thread

* [PATCH 1/3] hw/core: Tidy up unnecessary casting away of const
  2022-09-23 12:00 [PATCH 0/3] Drop useless casts from void * to pointer Markus Armbruster
@ 2022-09-23 12:00 ` Markus Armbruster
  2022-09-23 12:53   ` Philippe Mathieu-Daudé via
  2022-10-22 20:50   ` Laurent Vivier
  2022-09-23 12:00 ` [PATCH 2/3] Drop useless casts from g_malloc() & friends to pointer Markus Armbruster
                   ` (2 subsequent siblings)
  3 siblings, 2 replies; 11+ messages in thread
From: Markus Armbruster @ 2022-09-23 12:00 UTC (permalink / raw)
  To: qemu-devel; +Cc: qemu-trivial

Signed-off-by: Markus Armbruster <armbru@redhat.com>
---
 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, void *opaque)
     void *guest_fdt = 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];
 
@@ -339,7 +340,7 @@ static int add_amd_xgbe_fdt_node(SysBusDevice *sbdev, void *opaque)
         error_report("%s clocks property should contain 2 handles", __func__);
         exit(1);
     }
-    host_clock_phandles = (uint32_t *)r;
+    host_clock_phandles = r;
     guest_clock_phandles[0] = qemu_fdt_alloc_phandle(guest_fdt);
     guest_clock_phandles[1] = qemu_fdt_alloc_phandle(guest_fdt);
 
-- 
2.37.2



^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH 2/3] Drop useless casts from g_malloc() & friends to pointer
  2022-09-23 12:00 [PATCH 0/3] Drop useless casts from void * to pointer Markus Armbruster
  2022-09-23 12:00 ` [PATCH 1/3] hw/core: Tidy up unnecessary casting away of const Markus Armbruster
@ 2022-09-23 12:00 ` Markus Armbruster
  2022-10-22 20:52   ` Laurent Vivier
  2022-09-23 12:00 ` [PATCH 3/3] Drop more useless casts from void * " Markus Armbruster
  2022-10-20 12:12 ` [PATCH 0/3] Drop " Markus Armbruster
  3 siblings, 1 reply; 11+ messages in thread
From: Markus Armbruster @ 2022-09-23 12:00 UTC (permalink / raw)
  To: qemu-devel; +Cc: qemu-trivial

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 <armbru@redhat.com>
---
 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)
 
 static void *mipid_init(void)
 {
-    struct mipid_s *s = (struct mipid_s *) g_malloc0(sizeof(*s));
+    struct mipid_s *s = g_malloc0(sizeof(*s));
 
     s->id = 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 = (struct n800_s *) g_malloc0(sizeof(*s));
+    struct n800_s *s = g_malloc0(sizeof(*s));
     MachineClass *mc = MACHINE_GET_CLASS(machine);
 
     if (machine->ram_size != 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 = NULL;
 
-    q->data = (uint8_t *)g_malloc0(q->size);
+    q->data = g_malloc0(q->size);
 
     q->sp = 0;
     q->rp = 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 = {
 
 void *s1d13745_init(qemu_irq gpio_int)
 {
-    BlizzardState *s = (BlizzardState *) g_malloc0(sizeof(*s));
+    BlizzardState *s = g_malloc0(sizeof(*s));
     DisplaySurface *surface;
 
     s->fb = 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)
 
 CBus *cbus_init(qemu_irq dat)
 {
-    CBusPriv *s = (CBusPriv *) g_malloc0(sizeof(*s));
+    CBusPriv *s = g_malloc0(sizeof(*s));
 
     s->dat_out = dat;
     s->cbus.clk = qemu_allocate_irq(cbus_clk, s, 0);
@@ -388,7 +388,7 @@ static void retu_io(void *opaque, int rw, int reg, uint16_t *val)
 
 void *retu_init(qemu_irq irq, int vilma)
 {
-    CBusRetu *s = (CBusRetu *) g_malloc0(sizeof(*s));
+    CBusRetu *s = g_malloc0(sizeof(*s));
 
     s->irq = irq;
     s->irqen = 0xffff;
@@ -604,7 +604,7 @@ static void tahvo_io(void *opaque, int rw, int reg, uint16_t *val)
 
 void *tahvo_init(qemu_irq irq, int betty)
 {
-    CBusTahvo *s = (CBusTahvo *) g_malloc0(sizeof(*s));
+    CBusTahvo *s = g_malloc0(sizeof(*s));
 
     s->irq = irq;
     s->irqen = 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 nwords)
         addrbits = 6;
     }
 
-    eeprom = (eeprom_t *)g_malloc0(sizeof(*eeprom) + nwords * 2);
+    eeprom = g_malloc0(sizeof(*eeprom) + nwords * 2);
     eeprom->size = nwords;
     eeprom->addrbits = 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 *base,
     const uint8_t *apdu, uint32_t len)
 {
     EmulatedState *card = EMULATED_CCID_CARD(base);
-    EmulEvent *event = (EmulEvent *)g_malloc(sizeof(EmulEvent) + len);
+    EmulEvent *event = g_malloc(sizeof(EmulEvent) + len);
 
     assert(event);
     event->p.data.type = 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)
     }
 
     assert(msr_list.nmsrs > 0);
-    kvm_feature_msrs = (struct kvm_msr_list *) \
-        g_malloc0(sizeof(msr_list) +
+    kvm_feature_msrs = g_malloc0(sizeof(msr_list) +
                  msr_list.nmsrs * sizeof(msr_list.indices[0]));
 
     kvm_feature_msrs->nmsrs = 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);
 
     struct whpx_breakpoint_collection *new_breakpoints =
-        (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));
 
     new_breakpoints->allocated = max_breakpoints;
     new_breakpoints->used = 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 = nb_hw_breakpoints * sizeof(struct kvm_hw_breakpoint);
         hw_breakpoints =
-             (struct kvm_hw_breakpoint *)g_realloc(hw_breakpoints, size);
+             g_realloc(hw_breakpoints, size);
     } else {
         g_free(hw_breakpoints);
         hw_breakpoints = 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;
 
-    last_fg = (uint8_t *) g_malloc(VNC_SERVER_FB_BYTES);
-    last_bg = (uint8_t *) g_malloc(VNC_SERVER_FB_BYTES);
+    last_fg = g_malloc(VNC_SERVER_FB_BYTES);
+    last_bg = g_malloc(VNC_SERVER_FB_BYTES);
     has_fg = has_bg = 0;
     for (j = y; j < (y + h); j += 16) {
         for (i = x; i < (x + w); i += 16) {
-- 
2.37.2



^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH 3/3] Drop more useless casts from void * to pointer
  2022-09-23 12:00 [PATCH 0/3] Drop useless casts from void * to pointer Markus Armbruster
  2022-09-23 12:00 ` [PATCH 1/3] hw/core: Tidy up unnecessary casting away of const Markus Armbruster
  2022-09-23 12:00 ` [PATCH 2/3] Drop useless casts from g_malloc() & friends to pointer Markus Armbruster
@ 2022-09-23 12:00 ` Markus Armbruster
  2022-10-22 21:07   ` Laurent Vivier
  2022-10-20 12:12 ` [PATCH 0/3] Drop " Markus Armbruster
  3 siblings, 1 reply; 11+ messages in thread
From: Markus Armbruster @ 2022-09-23 12:00 UTC (permalink / raw)
  To: qemu-devel; +Cc: qemu-trivial

Signed-off-by: Markus Armbruster <armbru@redhat.com>
---
 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 = p % TARGET_PAGE_SIZE;
-                pag = (char *)page[p / TARGET_PAGE_SIZE];
+                pag = page[p / TARGET_PAGE_SIZE];
                 if (!pag) {
                     pag = g_try_malloc0(TARGET_PAGE_SIZE);
                     page[p / TARGET_PAGE_SIZE] = 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, qemu_plugin_meminfo_t info,
     g_mutex_lock(&l1_dcache_locks[cache_idx]);
     hit_in_l1 = access_cache(l1_dcaches[cache_idx], effective_addr);
     if (!hit_in_l1) {
-        insn = (InsnData *) userdata;
+        insn = 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, qemu_plugin_meminfo_t info,
 
     g_mutex_lock(&l2_ucache_locks[cache_idx]);
     if (!access_cache(l2_ucaches[cache_idx], effective_addr)) {
-        insn = (InsnData *) userdata;
+        insn = 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, void *userdata)
     g_mutex_lock(&l1_icache_locks[cache_idx]);
     hit_in_l1 = access_cache(l1_icaches[cache_idx], insn_addr);
     if (!hit_in_l1) {
-        insn = (InsnData *) userdata;
+        insn = 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, void *userdata)
 
     g_mutex_lock(&l2_ucache_locks[cache_idx]);
     if (!access_cache(l2_ucaches[cache_idx], insn_addr)) {
-        insn = (InsnData *) userdata;
+        insn = 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-blk/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,
 
     #if defined(__linux__) && defined(BLKDISCARD) && defined(BLKZEROOUT)
     VubDev *vdev_blk = req->vdev_blk;
-    desc = (struct virtio_blk_discard_write_zeroes *)buf;
+    desc = buf;
     uint64_t range[2] = { le64toh(desc->sector) << 9,
                           le32toh(desc->num_sectors) << 9 };
     if (type == 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 ClockPortInitArray clocks)
         Clock **clkp;
         /* offset cannot be inside the DeviceState part */
         assert(elem->offset > sizeof(DeviceState));
-        clkp = (Clock **)(((void *) dev) + elem->offset);
+        clkp = ((void *)dev) + elem->offset;
         if (elem->is_output) {
             *clkp = 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 = hv_msg->payload;
-    msg = (struct vmbus_message_header *)msgdata;
+    msg = msgdata;
 
     trace_vmbus_process_incoming_message(msg->message_type);
 
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 = (CadenceGEMState *)opaque;
+    s = opaque;
 
     offset >>= 2;
     retval = 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, NetClientState *nc,
     VirtioNetRscChain *chain;
     VirtioNetRscUnit unit;
 
-    chain = (VirtioNetRscChain *)opq;
+    chain = opq;
     hdr_len = ((VirtIONet *)(chain->n))->guest_hdr_len;
 
     if (size < (hdr_len + sizeof(struct eth_header) + sizeof(struct ip6_header)
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, NvmeRequest *req)
             nr_zones++;
         }
     }
-    header = (NvmeZoneReportHeader *)buf;
+    header = buf;
     header->nr_zones = cpu_to_le64(nr_zones);
 
     buf_p = buf + sizeof(NvmeZoneReportHeader);
     for (; zone_idx < ns->num_zones && max_zones > 0; zone_idx++) {
         zone = &ns->zone_array[zone_idx];
         if (nvme_zone_matches_filter(zrasf, zone)) {
-            z = (NvmeZoneDescr *)buf_p;
+            z = buf_p;
             buf_p += sizeof(NvmeZoneDescr);
 
             z->zt = 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 , PvrdmaRing **ring,
     r = g_malloc(sizeof(*r));
     *ring = r;
 
-    r->ring_state = (PvrdmaRingState *)
-        rdma_pci_dma_map(pci_dev, tbl[0], TARGET_PAGE_SIZE);
+    r->ring_state = rdma_pci_dma_map(pci_dev, tbl[0], TARGET_PAGE_SIZE);
 
     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 = sr;
 
     /* Create send ring */
-    sr->ring_state = (PvrdmaRingState *)
-        rdma_pci_dma_map(pci_dev, tbl[0], TARGET_PAGE_SIZE);
+    sr->ring_state = 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, PvrdmaRing **ring,
     r = g_malloc(sizeof(*r));
     *ring = r;
 
-    r->ring_state = (PvrdmaRingState *)
-            rdma_pci_dma_map(pci_dev, tbl[0], TARGET_PAGE_SIZE);
+    r->ring_state = 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)
 
     ring = (PvrdmaRing *)qp->opaque;
 
-    wqe = (struct PvrdmaSqWqe *)pvrdma_ring_next_elem_read(ring);
+    wqe = pvrdma_ring_next_elem_read(ring);
     while (wqe) {
         CompHandlerCtx *comp_ctx;
 
@@ -212,7 +212,7 @@ void pvrdma_qp_recv(PVRDMADev *dev, uint32_t qp_handle)
 
     ring = &((PvrdmaRing *)qp->opaque)[1];
 
-    wqe = (struct PvrdmaRqWqe *)pvrdma_ring_next_elem_read(ring);
+    wqe = pvrdma_ring_next_elem_read(ring);
     while (wqe) {
         CompHandlerCtx *comp_ctx;
 
@@ -254,7 +254,7 @@ void pvrdma_srq_recv(PVRDMADev *dev, uint32_t srq_handle)
 
     ring = (PvrdmaRing *)srq->opaque;
 
-    wqe = (struct PvrdmaRqWqe *)pvrdma_ring_next_elem_read(ring);
+    wqe = pvrdma_ring_next_elem_read(ring);
     while (wqe) {
         CompHandlerCtx *comp_ctx;
 
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 *vdev, VirtQueue *vq)
             output_size = s->config.probe_size + sizeof(tail);
             buf = g_malloc0(output_size);
 
-            ptail = (struct virtio_iommu_req_tail *)
-                        (buf + s->config.probe_size);
+            ptail = buf + s->config.probe_size;
             ptail->status = virtio_iommu_handle_probe(s, iov, iov_cnt, buf);
             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, uint8_t *buf_temp,
     for (i = 0; i < se->nb_fields; i++) {
         if (dst_offsets[i] == offsetof(struct rtentry, rt_dev)) {
             assert(*field_types == TYPE_PTRVOID);
-            target_rt_dev_ptr = (abi_ulong *)(argptr + src_offsets[i]);
+            target_rt_dev_ptr = argptr + src_offsets[i];
             host_rt_dev_ptr = (unsigned long *)(buf_temp + dst_offsets[i]);
             if (*target_rt_dev_ptr != 0) {
                 *host_rt_dev_ptr = (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 = { 0 };
 
     if (!df) {
-        ptr = (uint8_t *) buffer;
+        ptr = buffer;
     } else {
         ptr = 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);
 
     /* finally can we read/write the heap */
-    ptr_to_heap = (uint32_t *) info.heap_base;
+    ptr_to_heap = info.heap_base;
     for (i = 0; i < 512; i++) {
         *ptr_to_heap++ = i;
     }
-    ptr_to_heap = (uint32_t *) info.heap_base;
+    ptr_to_heap = info.heap_base;
     for (i = 0; i < 512; i++) {
         uint32_t tmp = *ptr_to_heap;
         if (tmp != 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_old);
 
     if (!leaderp->stack) {
-        leaderp->stack = (void *)bottom_old;
+        leaderp->stack = bottom_old;
         leaderp->stack_size = 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 = (struct vfio_info_cap_header *)(buf + cap->next);
+        cap = buf + cap->next;
     }
 
     cap_iova_range = (struct vfio_iommu_type1_info_cap_iova_range *)cap;
-- 
2.37.2



^ permalink raw reply related	[flat|nested] 11+ messages in thread

* Re: [PATCH 1/3] hw/core: Tidy up unnecessary casting away of const
  2022-09-23 12:00 ` [PATCH 1/3] hw/core: Tidy up unnecessary casting away of const Markus Armbruster
@ 2022-09-23 12:53   ` Philippe Mathieu-Daudé via
  2022-10-22 20:50   ` Laurent Vivier
  1 sibling, 0 replies; 11+ messages in thread
From: Philippe Mathieu-Daudé via @ 2022-09-23 12:53 UTC (permalink / raw)
  To: Markus Armbruster; +Cc: qemu-devel@nongnu.org Developers, QEMU Trivial

On Fri, Sep 23, 2022 at 2:30 PM Markus Armbruster <armbru@redhat.com> wrote:
>
> Signed-off-by: Markus Armbruster <armbru@redhat.com>
> ---
>  hw/core/sysbus-fdt.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)

Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH 0/3] Drop useless casts from void * to pointer
  2022-09-23 12:00 [PATCH 0/3] Drop useless casts from void * to pointer Markus Armbruster
                   ` (2 preceding siblings ...)
  2022-09-23 12:00 ` [PATCH 3/3] Drop more useless casts from void * " Markus Armbruster
@ 2022-10-20 12:12 ` Markus Armbruster
  2022-10-22 21:07   ` Laurent Vivier
  3 siblings, 1 reply; 11+ messages in thread
From: Markus Armbruster @ 2022-10-20 12:12 UTC (permalink / raw)
  To: qemu-trivial; +Cc: qemu-devel

Could this go via qemu-trivial now?



^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH 1/3] hw/core: Tidy up unnecessary casting away of const
  2022-09-23 12:00 ` [PATCH 1/3] hw/core: Tidy up unnecessary casting away of const Markus Armbruster
  2022-09-23 12:53   ` Philippe Mathieu-Daudé via
@ 2022-10-22 20:50   ` Laurent Vivier
  1 sibling, 0 replies; 11+ messages in thread
From: Laurent Vivier @ 2022-10-22 20:50 UTC (permalink / raw)
  To: Markus Armbruster, qemu-devel; +Cc: qemu-trivial

Le 23/09/2022 à 14:00, Markus Armbruster a écrit :
> Signed-off-by: Markus Armbruster <armbru@redhat.com>
> ---
>   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, void *opaque)
>       void *guest_fdt = 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];
>   
> @@ -339,7 +340,7 @@ static int add_amd_xgbe_fdt_node(SysBusDevice *sbdev, void *opaque)
>           error_report("%s clocks property should contain 2 handles", __func__);
>           exit(1);
>       }
> -    host_clock_phandles = (uint32_t *)r;
> +    host_clock_phandles = r;
>       guest_clock_phandles[0] = qemu_fdt_alloc_phandle(guest_fdt);
>       guest_clock_phandles[1] = qemu_fdt_alloc_phandle(guest_fdt);
>   

Applied to my trivial-patches branch.

Thanks,
Laurent




^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH 2/3] Drop useless casts from g_malloc() & friends to pointer
  2022-09-23 12:00 ` [PATCH 2/3] Drop useless casts from g_malloc() & friends to pointer Markus Armbruster
@ 2022-10-22 20:52   ` Laurent Vivier
  0 siblings, 0 replies; 11+ messages in thread
From: Laurent Vivier @ 2022-10-22 20:52 UTC (permalink / raw)
  To: Markus Armbruster, qemu-devel; +Cc: qemu-trivial

Le 23/09/2022 à 14:00, Markus Armbruster a écrit :
> 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 <armbru@redhat.com>
> ---
>   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)
>   
>   static void *mipid_init(void)
>   {
> -    struct mipid_s *s = (struct mipid_s *) g_malloc0(sizeof(*s));
> +    struct mipid_s *s = g_malloc0(sizeof(*s));
>   
>       s->id = 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 = (struct n800_s *) g_malloc0(sizeof(*s));
> +    struct n800_s *s = g_malloc0(sizeof(*s));
>       MachineClass *mc = MACHINE_GET_CLASS(machine);
>   
>       if (machine->ram_size != 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 = NULL;
>   
> -    q->data = (uint8_t *)g_malloc0(q->size);
> +    q->data = g_malloc0(q->size);
>   
>       q->sp = 0;
>       q->rp = 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 = {
>   
>   void *s1d13745_init(qemu_irq gpio_int)
>   {
> -    BlizzardState *s = (BlizzardState *) g_malloc0(sizeof(*s));
> +    BlizzardState *s = g_malloc0(sizeof(*s));
>       DisplaySurface *surface;
>   
>       s->fb = 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)
>   
>   CBus *cbus_init(qemu_irq dat)
>   {
> -    CBusPriv *s = (CBusPriv *) g_malloc0(sizeof(*s));
> +    CBusPriv *s = g_malloc0(sizeof(*s));
>   
>       s->dat_out = dat;
>       s->cbus.clk = qemu_allocate_irq(cbus_clk, s, 0);
> @@ -388,7 +388,7 @@ static void retu_io(void *opaque, int rw, int reg, uint16_t *val)
>   
>   void *retu_init(qemu_irq irq, int vilma)
>   {
> -    CBusRetu *s = (CBusRetu *) g_malloc0(sizeof(*s));
> +    CBusRetu *s = g_malloc0(sizeof(*s));
>   
>       s->irq = irq;
>       s->irqen = 0xffff;
> @@ -604,7 +604,7 @@ static void tahvo_io(void *opaque, int rw, int reg, uint16_t *val)
>   
>   void *tahvo_init(qemu_irq irq, int betty)
>   {
> -    CBusTahvo *s = (CBusTahvo *) g_malloc0(sizeof(*s));
> +    CBusTahvo *s = g_malloc0(sizeof(*s));
>   
>       s->irq = irq;
>       s->irqen = 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 nwords)
>           addrbits = 6;
>       }
>   
> -    eeprom = (eeprom_t *)g_malloc0(sizeof(*eeprom) + nwords * 2);
> +    eeprom = g_malloc0(sizeof(*eeprom) + nwords * 2);
>       eeprom->size = nwords;
>       eeprom->addrbits = 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 *base,
>       const uint8_t *apdu, uint32_t len)
>   {
>       EmulatedState *card = EMULATED_CCID_CARD(base);
> -    EmulEvent *event = (EmulEvent *)g_malloc(sizeof(EmulEvent) + len);
> +    EmulEvent *event = g_malloc(sizeof(EmulEvent) + len);
>   
>       assert(event);
>       event->p.data.type = 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)
>       }
>   
>       assert(msr_list.nmsrs > 0);
> -    kvm_feature_msrs = (struct kvm_msr_list *) \
> -        g_malloc0(sizeof(msr_list) +
> +    kvm_feature_msrs = g_malloc0(sizeof(msr_list) +
>                    msr_list.nmsrs * sizeof(msr_list.indices[0]));
>   
>       kvm_feature_msrs->nmsrs = 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);
>   
>       struct whpx_breakpoint_collection *new_breakpoints =
> -        (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));
>   
>       new_breakpoints->allocated = max_breakpoints;
>       new_breakpoints->used = 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 = nb_hw_breakpoints * sizeof(struct kvm_hw_breakpoint);
>           hw_breakpoints =
> -             (struct kvm_hw_breakpoint *)g_realloc(hw_breakpoints, size);
> +             g_realloc(hw_breakpoints, size);
>       } else {
>           g_free(hw_breakpoints);
>           hw_breakpoints = 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;
>   
> -    last_fg = (uint8_t *) g_malloc(VNC_SERVER_FB_BYTES);
> -    last_bg = (uint8_t *) g_malloc(VNC_SERVER_FB_BYTES);
> +    last_fg = g_malloc(VNC_SERVER_FB_BYTES);
> +    last_bg = g_malloc(VNC_SERVER_FB_BYTES);
>       has_fg = has_bg = 0;
>       for (j = y; j < (y + h); j += 16) {
>           for (i = x; i < (x + w); i += 16) {

Reviewed-by: Laurent Vivier <laurent@vivier.eu>



^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH 3/3] Drop more useless casts from void * to pointer
  2022-09-23 12:00 ` [PATCH 3/3] Drop more useless casts from void * " Markus Armbruster
@ 2022-10-22 21:07   ` Laurent Vivier
  2022-11-23 13:24     ` Markus Armbruster
  0 siblings, 1 reply; 11+ messages in thread
From: Laurent Vivier @ 2022-10-22 21:07 UTC (permalink / raw)
  To: Markus Armbruster, qemu-devel; +Cc: qemu-trivial

Le 23/09/2022 à 14:00, Markus Armbruster a écrit :
> Signed-off-by: Markus Armbruster <armbru@redhat.com>
> ---
>   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/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_old);
>   
>       if (!leaderp->stack) {
> -        leaderp->stack = (void *)bottom_old;
> +        leaderp->stack = bottom_old;

bottom_old is "const void *" and stack is "void *", I think compiler will complain we discard the 
"const" qualifier.

Otherwise:

Reviewed-by: Laurent Vivier <laurent@vivier.eu>



^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH 0/3] Drop useless casts from void * to pointer
  2022-10-20 12:12 ` [PATCH 0/3] Drop " Markus Armbruster
@ 2022-10-22 21:07   ` Laurent Vivier
  0 siblings, 0 replies; 11+ messages in thread
From: Laurent Vivier @ 2022-10-22 21:07 UTC (permalink / raw)
  To: Markus Armbruster, qemu-trivial; +Cc: qemu-devel

Le 20/10/2022 à 14:12, Markus Armbruster a écrit :
> Could this go via qemu-trivial now?
> 
> 

Yes, sorry for the delay.

I think there is a problem with PATCH 3.

Thanks,
Laurent


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH 3/3] Drop more useless casts from void * to pointer
  2022-10-22 21:07   ` Laurent Vivier
@ 2022-11-23 13:24     ` Markus Armbruster
  0 siblings, 0 replies; 11+ messages in thread
From: Markus Armbruster @ 2022-11-23 13:24 UTC (permalink / raw)
  To: Laurent Vivier; +Cc: qemu-devel, qemu-trivial

Laurent Vivier <laurent@vivier.eu> writes:

> Le 23/09/2022 à 14:00, Markus Armbruster a écrit :
>> Signed-off-by: Markus Armbruster <armbru@redhat.com>
>> ---
>>   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/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_old);
>>         if (!leaderp->stack) {
>> -        leaderp->stack = (void *)bottom_old;
>> +        leaderp->stack = bottom_old;
>
> bottom_old is "const void *" and stack is "void *", I think compiler will complain we discard the "const" qualifier.

You're right.

> Otherwise:
>
> Reviewed-by: Laurent Vivier <laurent@vivier.eu>

Thanks!



^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2022-11-23 13:25 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-09-23 12:00 [PATCH 0/3] Drop useless casts from void * to pointer Markus Armbruster
2022-09-23 12:00 ` [PATCH 1/3] hw/core: Tidy up unnecessary casting away of const Markus Armbruster
2022-09-23 12:53   ` Philippe Mathieu-Daudé via
2022-10-22 20:50   ` Laurent Vivier
2022-09-23 12:00 ` [PATCH 2/3] Drop useless casts from g_malloc() & friends to pointer Markus Armbruster
2022-10-22 20:52   ` Laurent Vivier
2022-09-23 12:00 ` [PATCH 3/3] Drop more useless casts from void * " Markus Armbruster
2022-10-22 21:07   ` Laurent Vivier
2022-11-23 13:24     ` Markus Armbruster
2022-10-20 12:12 ` [PATCH 0/3] Drop " Markus Armbruster
2022-10-22 21:07   ` Laurent Vivier

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).