diff mbox series

[v2,24/83] common/dpaax: simplify kernel compat macros

Message ID 20220124174719.14417-25-stephen@networkplumber.org (mailing list archive)
State Superseded, archived
Delegated to: Thomas Monjalon
Headers show
Series remove unnecessary null checks | expand


Context Check Description
ci/checkpatch success coding style OK

Commit Message

Stephen Hemminger Jan. 24, 2022, 5:46 p.m. UTC
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@networkplumber.org>
 drivers/common/dpaax/compat.h | 11 ++---------
 1 file changed, 2 insertions(+), 9 deletions(-)
diff mbox series


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)