[dpdk-dev] [PATCH 08/11] hash: remove useless casts
Stephen Hemminger
stephen at networkplumber.org
Fri Jul 24 19:06:21 CEST 2015
Found by coccinelle.
lib/librte_hash/rte_fbk_hash.c:153:7-32: WARNING: casting value returned by memory allocation function to (struct rte_fbk_hash_table *) is useless.
lib/librte_hash/rte_cuckoo_hash.c:218:6-21: WARNING: casting value returned by memory allocation function to (struct rte_hash *) is useless.
Signed-off-by: Stephen Hemminger <stephen at networkplumber.org>
---
lib/librte_hash/rte_cuckoo_hash.c | 4 ++--
lib/librte_hash/rte_fbk_hash.c | 3 +--
2 files changed, 3 insertions(+), 4 deletions(-)
diff --git a/lib/librte_hash/rte_cuckoo_hash.c b/lib/librte_hash/rte_cuckoo_hash.c
index 5cf4af6..3a4f5e9 100644
--- a/lib/librte_hash/rte_cuckoo_hash.c
+++ b/lib/librte_hash/rte_cuckoo_hash.c
@@ -215,8 +215,8 @@ rte_hash_create(const struct rte_hash_parameters *params)
goto err;
}
- h = (struct rte_hash *)rte_zmalloc_socket(hash_name, sizeof(struct rte_hash),
- RTE_CACHE_LINE_SIZE, params->socket_id);
+ h = rte_zmalloc_socket(hash_name, sizeof(struct rte_hash),
+ RTE_CACHE_LINE_SIZE, params->socket_id);
if (h == NULL) {
RTE_LOG(ERR, HASH, "memory allocation failed\n");
diff --git a/lib/librte_hash/rte_fbk_hash.c b/lib/librte_hash/rte_fbk_hash.c
index 8752a47..4c27756 100644
--- a/lib/librte_hash/rte_fbk_hash.c
+++ b/lib/librte_hash/rte_fbk_hash.c
@@ -150,8 +150,7 @@ rte_fbk_hash_create(const struct rte_fbk_hash_params *params)
}
/* Allocate memory for table. */
- ht = (struct rte_fbk_hash_table *)rte_zmalloc_socket(hash_name, mem_size,
- 0, params->socket_id);
+ ht = rte_zmalloc_socket(hash_name, mem_size, 0, params->socket_id);
if (ht == NULL) {
RTE_LOG(ERR, HASH, "Failed to allocate fbk hash table\n");
rte_free(te);
--
2.1.4
More information about the dev
mailing list