diff --git a/drivers/gpu/drm/amd/display/dc/os_types.h b/drivers/gpu/drm/amd/display/dc/os_types.h index 538d00105738..339372293a98 100644 --- a/drivers/gpu/drm/amd/display/dc/os_types.h +++ b/drivers/gpu/drm/amd/display/dc/os_types.h @@ -78,6 +78,23 @@ #define dc_breakpoint() do {} while (0) #endif +#ifdef __COVERITY__ +/* + * Static analysers see the WARN_ON() test as proof that the asserted condition + * can fail, then keep walking the failing path because nothing stops it. Model + * the assert as a path terminator so only genuinely reachable defects survive. + * __COVERITY__ is defined during analysis capture only, so the code emitted by + * a real build is unchanged. + */ +void __coverity_panic__(void); + +#define ASSERT_CRITICAL(expr) do { \ + if (!(expr)) \ + __coverity_panic__(); \ + } while (0) + +#define ASSERT(expr) ASSERT_CRITICAL(expr) +#else #define ASSERT_CRITICAL(expr) do { \ if (WARN_ON(!(expr))) \ dc_breakpoint(); \ @@ -87,6 +104,7 @@ if (WARN_ON_ONCE(!(expr))) \ dc_breakpoint(); \ } while (0) +#endif #define BREAK_TO_DEBUGGER() \ do { \