]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
drm/amd/display: Initialize denominator defaults to 1
authorAlex Hung <alex.hung@amd.com>
Tue, 17 Dec 2024 18:51:58 +0000 (11:51 -0700)
committerAlex Deucher <alexander.deucher@amd.com>
Fri, 10 Jan 2025 17:04:06 +0000 (12:04 -0500)
[WHAT & HOW]
Variables, used as denominators and maybe not assigned to other values,
should be initialized to non-zero to avoid DIVIDE_BY_ZERO, as reported
by Coverity.

Reviewed-by: Austin Zheng <austin.zheng@amd.com>
Reviewed-by: Rodrigo Siqueira <rodrigo.siqueira@amd.com>
Signed-off-by: Alex Hung <alex.hung@amd.com>
Signed-off-by: Tom Chung <chiahsuan.chung@amd.com>
Tested-by: Daniel Wheeler <daniel.wheeler@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/display/dc/dml2/dml21/src/dml2_core/dml2_core_dcn4_calcs.c

index b9ec243cf9ba5b45a430f2147ecd8b843e14fbd3..a3ffb8c95d253330dc5b5a7d818f8720c76b2e50 100644 (file)
@@ -600,8 +600,8 @@ static void CalculateBytePerPixelAndBlockSizes(
 {
        *BytePerPixelDETY = 0;
        *BytePerPixelDETC = 0;
-       *BytePerPixelY = 0;
-       *BytePerPixelC = 0;
+       *BytePerPixelY = 1;
+       *BytePerPixelC = 1;
 
        if (SourcePixelFormat == dml2_444_64) {
                *BytePerPixelDETY = 8;