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