*alloc() routines return void * and therefore cast is not needed.
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Reviewed-by: Bruce Richardson <bruce.richardson@intel.com>
[Thomas: reverse num and size parameters in vhost calloc]
goto fail;
}
kni_port_params_array[port_id] =
- (struct kni_port_params*)rte_zmalloc("KNI_port_params",
- sizeof(struct kni_port_params), RTE_CACHE_LINE_SIZE);
+ rte_zmalloc("KNI_port_params",
+ sizeof(struct kni_port_params), RTE_CACHE_LINE_SIZE);
kni_port_params_array[port_id]->port_id = port_id;
kni_port_params_array[port_id]->lcore_rx =
(uint8_t)int_fld[i++];
fseek(fh, 0, SEEK_SET);
- acl_rules = (uint8_t *)calloc(acl_num, rule_size);
+ acl_rules = calloc(acl_num, rule_size);
if (NULL == acl_rules)
rte_exit(EXIT_FAILURE, "%s: failed to malloc memory\n",
__func__);
- route_rules = (uint8_t *)calloc(route_num, rule_size);
+ route_rules = calloc(route_num, rule_size);
if (NULL == route_rules)
rte_exit(EXIT_FAILURE, "%s: failed to malloc memory\n",
}
- vdev->regions_hpa = (struct virtio_memory_regions_hpa *) rte_zmalloc("vhost hpa region",
- sizeof(struct virtio_memory_regions_hpa) * vdev->nregions_hpa,
- RTE_CACHE_LINE_SIZE);
+ vdev->regions_hpa = rte_calloc("vhost hpa region",
+ vdev->nregions_hpa,
+ sizeof(struct virtio_memory_regions_hpa),
+ RTE_CACHE_LINE_SIZE);
if (vdev->regions_hpa == NULL) {
RTE_LOG(ERR, VHOST_CONFIG, "Cannot allocate memory for hpa region\n");
rte_free(vdev);
if ((guest = get_xen_guest(dom_id)) != NULL)
return guest;
- guest = (struct xen_guest * )calloc(1, sizeof(struct xen_guest));
+ guest = calloc(1, sizeof(struct xen_guest));
if (guest) {
RTE_LOG(ERR, XENHOST, " %s: return newly created guest with %d rings\n", __func__, guest->vring_num);
TAILQ_INSERT_TAIL(&guest_root, guest, next);
goto err;
}
- gntnode = (struct xen_gntnode *)calloc(1, sizeof(struct xen_gntnode));
- gnt = (struct xen_gnt *)calloc(gref_num, sizeof(struct xen_gnt));
+ gntnode = calloc(1, sizeof(struct xen_gntnode));
+ gnt = calloc(gref_num, sizeof(struct xen_gnt));
if (gnt == NULL || gntnode == NULL)
goto err;