public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: "Pali Rohár" <pali@kernel.org>
To: Kyungmin Park <kmpark@infradead.org>, Heiko Schocher <hs@denx.de>
Cc: u-boot@lists.denx.de
Subject: [PATCH 2/2] ubifs: Use U-Boot assert() from <log.h> in UBI/UBIFS code
Date: Sun, 10 Jul 2022 13:38:07 +0200	[thread overview]
Message-ID: <20220710113807.20942-2-pali@kernel.org> (raw)
In-Reply-To: <20220710113807.20942-1-pali@kernel.org>

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 | 9 ++-------
 fs/ubifs/debug.h        | 9 ++-------
 2 files changed, 4 insertions(+), 14 deletions(-)

diff --git a/drivers/mtd/ubi/debug.h b/drivers/mtd/ubi/debug.h
index 2c2faaf1b4dc..9c8ce51636b1 100644
--- a/drivers/mtd/ubi/debug.h
+++ b/drivers/mtd/ubi/debug.h
@@ -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)                      \
diff --git a/fs/ubifs/debug.h b/fs/ubifs/debug.h
index d69f1e6ac70b..0ecc2e0c8e98 100644
--- a/fs/ubifs/debug.h
+++ b/fs/ubifs/debug.h
@@ -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, ...) \
-- 
2.20.1


  reply	other threads:[~2022-07-10 11:39 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-10 11:38 [PATCH 1/2] ubifs: Fix ubifs_assert_cmt_locked() Pali Rohár
2022-07-10 11:38 ` Pali Rohár [this message]
2022-07-20  3:55   ` [PATCH 2/2] ubifs: Use U-Boot assert() from <log.h> in UBI/UBIFS code Heiko Schocher
2022-07-20  3:55 ` [PATCH 1/2] ubifs: Fix ubifs_assert_cmt_locked() Heiko Schocher

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220710113807.20942-2-pali@kernel.org \
    --to=pali@kernel.org \
    --cc=hs@denx.de \
    --cc=kmpark@infradead.org \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox