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@xxxxxxxxxxx> --- drivers/gpu/drm/amd/display/dc/spl/spl_debug.h | 9 +++++++++ 1 file changed, 9 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 f01c932d550d..8220c5800692 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,27 @@ kgdb_breakpoint(); \ } \ } while (0) +#define SPL_ASSERT_EMERGENCY(expr) do { \ + kgdb_breakpoint(); \ + BUG_ON(!(expr)); \ +} 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_WARN(expr) SPL_ASSERT_CRITICAL(expr) +#define SPL_ASSERT_BUG(expr) SPL_ASSERT_EMERGENCY(expr) #else #define SPL_ASSERT_WARN(expr) WARN_ON(!(expr)) +#define SPL_ASSERT_BUG(expr) BUG_ON(!(expr)) #endif /* CONFIG_DEBUG_KERNEL_DC */ #define SPL_BREAK_TO_DEBUGGER() SPL_ASSERT_WARN(0) -- 2.42.0