[PATCH 09/23] cachefiles: use ASSERT_FAIL()/ASSERT_WARN() to cleanup some code

From: Chunguang Xu
Date: Thu Aug 27 2020 - 06:14:59 EST


Since ASSERT_FAIL() and ASSERT_WARN() have been provided, ASSERT()
may be realized through them, thus reducing code redundancy and
facilitating problem analysis.

Signed-off-by: Chunguang Xu <brookxu@xxxxxxxxxxx>
---
fs/cachefiles/internal.h | 9 +--------
1 file changed, 1 insertion(+), 8 deletions(-)

diff --git a/fs/cachefiles/internal.h b/fs/cachefiles/internal.h
index cf9bd64..2447437 100644
--- a/fs/cachefiles/internal.h
+++ b/fs/cachefiles/internal.h
@@ -316,14 +316,7 @@ extern int cachefiles_remove_object_xattr(struct cachefiles_cache *cache,

#if 1 /* defined(__KDEBUGALL) */

-#define ASSERT(X) \
-do { \
- if (unlikely(!(X))) { \
- pr_err("\n"); \
- pr_err("Assertion failed\n"); \
- BUG(); \
- } \
-} while (0)
+#define ASSERT(X) ASSERT_FAIL(x)

#define ASSERTCMP(X, OP, Y) \
do { \
--
1.8.3.1