diff mbox

[dpdk-dev,2/6] vhost_xen: remove unnecessary cast

Message ID 1423925950-5201-2-git-send-email-shemming@brocade.com (mailing list archive)
State Accepted, archived
Headers show

Commit Message

Stephen Hemminger Feb. 14, 2015, 2:59 p.m. UTC
Don't need to cast malloc family of functions since they return
void *.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
 examples/vhost_xen/vhost_monitor.c  | 2 +-
 examples/vhost_xen/xenstore_parse.c | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

Comments

Bruce Richardson Feb. 19, 2015, 2:53 p.m. UTC | #1
On Sat, Feb 14, 2015 at 09:59:06AM -0500, Stephen Hemminger wrote:
> Don't need to cast malloc family of functions since they return
> void *.
> 
> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>

Acked-by: Bruce Richardson <bruce.richardson@intel.com>

> ---
>  examples/vhost_xen/vhost_monitor.c  | 2 +-
>  examples/vhost_xen/xenstore_parse.c | 4 ++--
>  2 files changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/examples/vhost_xen/vhost_monitor.c b/examples/vhost_xen/vhost_monitor.c
> index f683989..9d99962 100644
> --- a/examples/vhost_xen/vhost_monitor.c
> +++ b/examples/vhost_xen/vhost_monitor.c
> @@ -138,7 +138,7 @@ add_xen_guest(int32_t dom_id)
>  	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);
> diff --git a/examples/vhost_xen/xenstore_parse.c b/examples/vhost_xen/xenstore_parse.c
> index 9441639..df191ac 100644
> --- a/examples/vhost_xen/xenstore_parse.c
> +++ b/examples/vhost_xen/xenstore_parse.c
> @@ -248,8 +248,8 @@ parse_gntnode(int dom_id, char *path)
>  		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;
>  
> -- 
> 2.1.4
>
diff mbox

Patch

diff --git a/examples/vhost_xen/vhost_monitor.c b/examples/vhost_xen/vhost_monitor.c
index f683989..9d99962 100644
--- a/examples/vhost_xen/vhost_monitor.c
+++ b/examples/vhost_xen/vhost_monitor.c
@@ -138,7 +138,7 @@  add_xen_guest(int32_t dom_id)
 	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);
diff --git a/examples/vhost_xen/xenstore_parse.c b/examples/vhost_xen/xenstore_parse.c
index 9441639..df191ac 100644
--- a/examples/vhost_xen/xenstore_parse.c
+++ b/examples/vhost_xen/xenstore_parse.c
@@ -248,8 +248,8 @@  parse_gntnode(int dom_id, char *path)
 		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;