ubifs: Use U-Boot assert() from <log.h> in UBI/UBIFS code
authorPali Rohár <pali@kernel.org>
Sun, 10 Jul 2022 11:38:07 +0000 (13:38 +0200)
committerHeiko Schocher <hs@denx.de>
Wed, 20 Jul 2022 03:50:13 +0000 (05:50 +0200)
U-Boot already provides assert function, so it use also in ubi and ubifs code.

Signed-off-by: Pali Rohár <pali@kernel.org>
drivers/mtd/ubi/debug.h
fs/ubifs/debug.h

index 2c2faaf..9c8ce51 100644 (file)
@@ -27,13 +27,8 @@ void ubi_dump_vid_hdr(const struct ubi_vid_hdr *vid_hdr);
        }                                                                    \
 } while (0)
 #else
-#define ubi_assert(expr)  do {                                               \
-       if (unlikely(!(expr))) {                                             \
-               pr_debug("UBI assert failed in %s at %u\n",                  \
-                      __func__, __LINE__);                                  \
-               dump_stack();                                                \
-       }                                                                    \
-} while (0)
+#include <log.h>
+#define ubi_assert(expr) assert(expr)
 #endif
 
 #define ubi_dbg_print_hex_dump(ps, pt, r, g, b, len, a)                      \
index d69f1e6..0ecc2e0 100644 (file)
@@ -165,14 +165,9 @@ struct ubifs_global_debug_info {
                 dbg_snprintf_key(c, key, __tmp_key_buf, DBG_KEY_BUF_LEN));    \
 } while (0)
 #else
-#define ubifs_assert(expr) do {                                                \
-       if (unlikely(!(expr))) {                                               \
-               pr_debug("UBIFS assert failed in %s at %u\n",                  \
-                      __func__, __LINE__);                                    \
-               dump_stack();                                                  \
-       }                                                                      \
-} while (0)
 
+#include <log.h>
+#define ubifs_assert(expr) assert(expr)
 #define ubifs_assert_cmt_locked(c) do { } while (0)
 
 #define ubifs_dbg_msg(type, fmt, ...) \