DPDK patches and discussions
 help / color / mirror / Atom feed
From: Stephen Hemminger <stephen@networkplumber.org>
To: dev@dpdk.org
Subject: [dpdk-dev] [PATCH 07/11] lpm: remove useless casts
Date: Fri, 24 Jul 2015 10:06:20 -0700	[thread overview]
Message-ID: <1437757584-15502-8-git-send-email-stephen@networkplumber.org> (raw)
In-Reply-To: <1437757584-15502-1-git-send-email-stephen@networkplumber.org>

Found by modified coccinelle script.
lib/librte_lpm/rte_lpm6.c:196:8-23: WARNING: casting value returned by memory allocation function to (struct rte_lpm6 *) is useless.
lib/librte_lpm/rte_lpm6.c:205:19-39: WARNING: casting value returned by memory allocation function to (struct rte_lpm6_rule *) is useless.
lib/librte_lpm/rte_lpm.c:195:8-22: WARNING: casting value returned by memory allocation function to (struct rte_lpm *) is useless.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
 lib/librte_lpm/rte_lpm.c  | 4 ++--
 lib/librte_lpm/rte_lpm6.c | 8 ++++----
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/lib/librte_lpm/rte_lpm.c b/lib/librte_lpm/rte_lpm.c
index de05307..e71bd15 100644
--- a/lib/librte_lpm/rte_lpm.c
+++ b/lib/librte_lpm/rte_lpm.c
@@ -192,8 +192,8 @@ rte_lpm_create(const char *name, int socket_id, int max_rules,
 	}
 
 	/* Allocate memory to store the LPM data structures. */
-	lpm = (struct rte_lpm *)rte_zmalloc_socket(mem_name, mem_size,
-			RTE_CACHE_LINE_SIZE, socket_id);
+	lpm = rte_zmalloc_socket(mem_name, mem_size,
+				 RTE_CACHE_LINE_SIZE, socket_id);
 	if (lpm == NULL) {
 		RTE_LOG(ERR, LPM, "LPM memory allocation failed\n");
 		rte_free(te);
diff --git a/lib/librte_lpm/rte_lpm6.c b/lib/librte_lpm/rte_lpm6.c
index 6c2b293..ec2d482 100644
--- a/lib/librte_lpm/rte_lpm6.c
+++ b/lib/librte_lpm/rte_lpm6.c
@@ -193,8 +193,8 @@ rte_lpm6_create(const char *name, int socket_id,
 	}
 
 	/* Allocate memory to store the LPM data structures. */
-	lpm = (struct rte_lpm6 *)rte_zmalloc_socket(mem_name, (size_t)mem_size,
-			RTE_CACHE_LINE_SIZE, socket_id);
+	lpm = rte_zmalloc_socket(mem_name, (size_t)mem_size,
+				 RTE_CACHE_LINE_SIZE, socket_id);
 
 	if (lpm == NULL) {
 		RTE_LOG(ERR, LPM, "LPM memory allocation failed\n");
@@ -202,8 +202,8 @@ rte_lpm6_create(const char *name, int socket_id,
 		goto exit;
 	}
 
-	lpm->rules_tbl = (struct rte_lpm6_rule *)rte_zmalloc_socket(NULL,
-			(size_t)rules_size, RTE_CACHE_LINE_SIZE, socket_id);
+	lpm->rules_tbl = rte_zmalloc_socket(NULL, (size_t)rules_size,
+					    RTE_CACHE_LINE_SIZE, socket_id);
 
 	if (lpm->rules_tbl == NULL) {
 		RTE_LOG(ERR, LPM, "LPM memory allocation failed\n");
-- 
2.1.4

  parent reply	other threads:[~2015-07-24 17:06 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-07-24 17:06 [dpdk-dev] [PATCH 00/11] misc cleanup patches Stephen Hemminger
2015-07-24 17:06 ` [dpdk-dev] [PATCH 01/11] eth: move queue check for rx_queue_count Stephen Hemminger
2015-07-26 13:47   ` Thomas Monjalon
2015-08-03 17:00   ` Zhang, Helin
2015-07-24 17:06 ` [dpdk-dev] [PATCH 02/11] eth: do simple return Stephen Hemminger
2015-07-24 17:06 ` [dpdk-dev] [PATCH 03/11] kni: remove useless semicolon Stephen Hemminger
2015-07-24 17:06 ` [dpdk-dev] [PATCH 04/11] eth: remove unnecessary return value Stephen Hemminger
2015-07-24 17:06 ` [dpdk-dev] [PATCH 05/11] kni: eliminate unnecessary return variables Stephen Hemminger
2015-07-24 17:06 ` [dpdk-dev] [PATCH 06/11] pipeline: remove useless cast Stephen Hemminger
2015-07-24 17:06 ` Stephen Hemminger [this message]
2015-07-24 17:06 ` [dpdk-dev] [PATCH 08/11] hash: remove useless casts Stephen Hemminger
2015-07-24 17:06 ` [dpdk-dev] [PATCH 09/11] kni: remove useless cast Stephen Hemminger
2015-07-24 17:06 ` [dpdk-dev] [PATCH 10/11] i40e: " Stephen Hemminger
2015-08-03 16:56   ` Zhang, Helin
2015-07-24 17:06 ` [dpdk-dev] [PATCH 11/11] bond: " Stephen Hemminger

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1437757584-15502-8-git-send-email-stephen@networkplumber.org \
    --to=stephen@networkplumber.org \
    --cc=dev@dpdk.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).