[PATCH v2 24/83] common/dpaax: simplify kernel compat macros
Stephen Hemminger
stephen at networkplumber.org
Mon Jan 24 18:46:20 CET 2022
The compat wrapper had unnecessary NULL check and also
the emulation of kzalloc() should just use equivalent rte_zmalloc().
Signed-off-by: Stephen Hemminger <stephen at networkplumber.org>
---
drivers/common/dpaax/compat.h | 11 ++---------
1 file changed, 2 insertions(+), 9 deletions(-)
diff --git a/drivers/common/dpaax/compat.h b/drivers/common/dpaax/compat.h
index 7166f8cceb41..cbabc1588b21 100644
--- a/drivers/common/dpaax/compat.h
+++ b/drivers/common/dpaax/compat.h
@@ -339,16 +339,9 @@ static inline void copy_bytes(void *dest, const void *src, size_t sz)
/* Allocator stuff */
#define kmalloc(sz, t) rte_malloc(NULL, sz, 0)
+#define kzalloc(sz, t) rte_zmalloc(NULL, sz, 0)
#define vmalloc(sz) rte_malloc(NULL, sz, 0)
-#define kfree(p) { if (p) rte_free(p); }
-static inline void *kzalloc(size_t sz, gfp_t __foo __rte_unused)
-{
- void *ptr = rte_malloc(NULL, sz, 0);
-
- if (ptr)
- memset(ptr, 0, sz);
- return ptr;
-}
+#define kfree(p) rte_free(p)
static inline unsigned long get_zeroed_page(gfp_t __foo __rte_unused)
{
--
2.30.2
More information about the dev
mailing list