Messages in this thread Patch in this message |  | | From | Tiezhu Yang <> | | Subject | [PATCH v4 2/3] drm/amd/display: Add SPL_ASSERT_BUG() macro definition | | Date | Tue, 14 Jan 2025 21:30:15 +0800 |
| |
In order to keep the current ability for the aim of debugging and avoid printing the warning message twice, add SPL_ASSERT_BUG() macro definition to harden the callers of division functions.
Signed-off-by: Tiezhu Yang <yangtiezhu@loongson.cn> --- drivers/gpu/drm/amd/display/dc/spl/spl_debug.h | 11 +++++++++++ 1 file changed, 11 insertions(+)
diff --git a/drivers/gpu/drm/amd/display/dc/spl/spl_debug.h b/drivers/gpu/drm/amd/display/dc/spl/spl_debug.h index a6f6132df241..d31988c647e5 100644 --- a/drivers/gpu/drm/amd/display/dc/spl/spl_debug.h +++ b/drivers/gpu/drm/amd/display/dc/spl/spl_debug.h @@ -11,18 +11,29 @@ kgdb_breakpoint(); \ } \ } while (0) +#define SPL_ASSERT_EMERGENCY(expr) do { \ + if (!(expr)) { \ + kgdb_breakpoint(); \ + BUG(); \ + } \ +} while (0) #else #define SPL_ASSERT_CRITICAL(expr) do { \ if (WARN_ON(!(expr))) { \ ; \ } \ } while (0) +#define SPL_ASSERT_EMERGENCY(expr) do { \ + BUG_ON(!(expr)); \ +} while (0) #endif /* CONFIG_HAVE_KGDB || CONFIG_KGDB */ #if defined(CONFIG_DEBUG_KERNEL_DC) #define SPL_ASSERT(expr) SPL_ASSERT_CRITICAL(expr) +#define SPL_ASSERT_BUG(expr) SPL_ASSERT_EMERGENCY(expr) #else #define SPL_ASSERT(expr) WARN_ON(!(expr)) +#define SPL_ASSERT_BUG(expr) BUG_ON(!(expr)) #endif /* CONFIG_DEBUG_KERNEL_DC */ #define SPL_BREAK_TO_DEBUGGER() SPL_ASSERT(0) -- 2.42.0
|  |