drm/amd/display: Model ASSERT as path terminator

[WHAT]
ASSERT() and ASSERT_CRITICAL() expand to a WARN_ON() test that falls
through, because dc_breakpoint() is a no-op unless
CONFIG_DEBUG_KERNEL_DC is set.

Static analysers read that test as proof the asserted condition can
fail, then keep walking the failing path because nothing stops it. The
assert therefore manufactures the very defect it guards against, and
Coverity reports DIVIDE_BY_ZERO defects whose entire path is the assert
itself.

[HOW]
Redefine both macros to call a declaration-only __coverity_panic__()
when the asserted condition fails, which marks the failing path as
unreachable and leaves only genuinely reachable defects.

The override is guarded by __COVERITY__, which is defined only while
the analyser captures the build, so the code emitted by a normal build
is unchanged.

Assisted-by: Copilot:Claude-Opus-5
Reviewed-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Alex Hung <alex.hung@amd.com>
Tested-by: Dan Wheeler <daniel.wheeler@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
This commit is contained in:
Alex Hung 2026-08-10 17:29:02 -06:00 • committed by Alex Deucher
commit 8e0822223a