[dpdk-dev,08/11] hash: remove useless casts
Commit Message
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@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(-)
@@ -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");
@@ -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);