]> git.ipfire.org Git - thirdparty/linux.git/commit
drm/amd/display: Silence type conversion warnings in dml2
authorGaghik Khachatrian <gaghik.khachatrian@amd.com>
Mon, 16 Mar 2026 15:34:49 +0000 (11:34 -0400)
committerAlex Deucher <alexander.deucher@amd.com>
Mon, 30 Mar 2026 19:12:47 +0000 (15:12 -0400)
commit3722df98c2e724121c40ea7ad59988262dbdb98f
treeba0d728d8e907efb59ffe37531e702fd377f79b8
parentc3f327a9a306444cd91b904d7fcdba9406017390
drm/amd/display: Silence type conversion warnings in dml2

[Why]
Compiler build generates type conversion warnings throughout dc/dml2_0
where values are implicitly narrowed (e.g. int/uint32_t/uint64_t assigned
to uint8_t, unsigned char, char, bool, or dml_bool_t), cluttering build
output and masking genuine issues.

[How]
Add explicit casts at each narrowing assignment with ASSERT guards
to catch out-of-range values in debug builds:
- uint8_t: otg_inst, num_planes, pipe_idx, vblank_index fields
- unsigned char: pipe_dlg_param.otg_inst from tg->inst
- char: mcache num_pipes from num_dpps_required
- bool/dml_bool_t: INTERLACE bitfield and fams2 enable flag use != 0
- uint64_t: widen min_hardware_refresh_in_uhz to hold div64_u64 result,
  then cast to unsigned long for min_refresh_uhz with ASSERT

Reviewed-by: Austin Zheng <austin.zheng@amd.com>
Signed-off-by: Gaghik Khachatrian <gaghik.khachatrian@amd.com>
Signed-off-by: Chuanyu Tseng <chuanyu.tseng@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/display/dc/dml2_0/dml21/dml21_translation_helper.c
drivers/gpu/drm/amd/display/dc/dml2_0/dml21/dml21_utils.c
drivers/gpu/drm/amd/display/dc/dml2_0/dml21/dml21_wrapper_fpu.c
drivers/gpu/drm/amd/display/dc/dml2_0/dml2_dc_resource_mgmt.c
drivers/gpu/drm/amd/display/dc/dml2_0/dml2_mall_phantom.c
drivers/gpu/drm/amd/display/dc/dml2_0/dml2_translation_helper.c
drivers/gpu/drm/amd/display/dc/dml2_0/dml2_utils.c