[23/82] common/dpaax: simplify kernel compat macros

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

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

Stephen Hemminger Jan. 24, 2022, 12:04 a.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(-)
  

Comments

Hemant Agrawal Jan. 24, 2022, 5:06 a.m. UTC | #1
Acked-by:  Hemant Agrawal <hemant.agrawal@nxp.com>
  

Patch

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)
 {