Hello Qingqing Zhuo, The patch 7966f319c66d: "drm/amd/display: Introduce DML2" from Jul 28, 2023 (linux-next), leads to the following Smatch static checker warning: drivers/gpu/drm/amd/amdgpu/../display/dc/dml2/display_mode_core.c:2748 TruncToValidBPP() warn: inconsistent indenting drivers/gpu/drm/amd/amdgpu/../display/dc/dml2/display_mode_core.c 2736 MinDSCBPP = 8; 2737 MaxDSCBPP = 3 * DSCInputBitPerComponent - 1.0 / 16; 2738 } else { 2739 if (Output == dml_hdmi) { 2740 NonDSCBPP0 = 24; 2741 NonDSCBPP1 = 24; 2742 NonDSCBPP2 = 24; 2743 } else { 2744 NonDSCBPP0 = 16; 2745 NonDSCBPP1 = 20; 2746 NonDSCBPP2 = 24; 2747 } --> 2748 if (Format == dml_n422) { This code should be indented another tab. 2749 MinDSCBPP = 7; 2750 MaxDSCBPP = 2 * DSCInputBitPerComponent - 1.0 / 16.0; 2751 } else { 2752 MinDSCBPP = 8; 2753 MaxDSCBPP = 3 * DSCInputBitPerComponent - 1.0 / 16.0; 2754 } 2755 } 2756 2757 if (Output == dml_dp2p0) { 2758 MaxLinkBPP = LinkBitRate * Lanes / PixelClock * 128.0 / 132.0 * 383.0 / 384.0 * 65536.0 / 65540.0; There are a bunch of other warnings as well. Too many to review. regards, dan carpenter drivers/gpu/drm/amd/amdgpu/../display/amdgpu_dm/amdgpu_dm.c:2903 dm_resume() warn: inconsistent indenting drivers/gpu/drm/amd/amdgpu/../display/dc/basics/dce_calcs.c:914 calculate_bandwidth() error: uninitialized symbol 'max_chunks_fbc_mode'. drivers/gpu/drm/amd/amdgpu/../display/dc/basics/dce_calcs.c:917 calculate_bandwidth() error: uninitialized symbol 'max_chunks_fbc_mode'. drivers/gpu/drm/amd/amdgpu/../display/dc/clk_mgr/dcn35/dcn35_clk_mgr.c:702 dcn35_clk_mgr_helper_populate_bw_params() warn: if statement not indented drivers/gpu/drm/amd/amdgpu/../display/dc/dml2/display_mode_core.c:1207 CalculatePrefetchSchedule() warn: inconsistent indenting drivers/gpu/drm/amd/amdgpu/../display/dc/dml2/display_mode_core.c:1288 CalculatePrefetchSchedule() warn: inconsistent indenting drivers/gpu/drm/amd/amdgpu/../display/dc/dml2/display_mode_core.c:1455 CalculatePrefetchSchedule() warn: inconsistent indenting drivers/gpu/drm/amd/amdgpu/../display/dc/dml2/display_mode_core.c:1558 CalculatePrefetchSchedule() warn: inconsistent indenting drivers/gpu/drm/amd/amdgpu/../display/dc/dml2/display_mode_core.c:2645 CalculateVMAndRowBytes() warn: previously used '*PixelPTEReqWidth' as divisor (see line 2634) drivers/gpu/drm/amd/amdgpu/../display/dc/dml2/display_mode_core.c:2748 TruncToValidBPP() warn: inconsistent indenting drivers/gpu/drm/amd/amdgpu/../display/dc/dml2/display_mode_core.c:2750 TruncToValidBPP() warn: inconsistent indenting drivers/gpu/drm/amd/amdgpu/../display/dc/dml2/display_mode_core.c:2812 TruncToValidBPP() warn: ignoring unreachable code. drivers/gpu/drm/amd/amdgpu/../display/dc/dml2/display_mode_core.c:3171 CalculateDCFCLKDeepSleep() warn: inconsistent indenting drivers/gpu/drm/amd/amdgpu/../display/dc/dml2/display_mode_core.c:3749 CalculateVMGroupAndRequestTimes() warn: inconsistent indenting drivers/gpu/drm/amd/amdgpu/../display/dc/dml2/display_mode_core.c:4051 CalculateStutterEfficiency() warn: inconsistent indenting drivers/gpu/drm/amd/amdgpu/../display/dc/dml2/display_mode_core.c:4201 CalculateSwathAndDETConfiguration() warn: inconsistent indenting drivers/gpu/drm/amd/amdgpu/../display/dc/dml2/display_mode_core.c:4247 CalculateSwathAndDETConfiguration() warn: inconsistent indenting drivers/gpu/drm/amd/amdgpu/../display/dc/dml2/display_mode_core.c:4784 CalculateSurfaceSizeInMall() warn: inconsistent indenting drivers/gpu/drm/amd/amdgpu/../display/dc/dml2/display_mode_core.c:4789 CalculateSurfaceSizeInMall() warn: inconsistent indenting drivers/gpu/drm/amd/amdgpu/../display/dc/dml2/display_mode_core.c:5196 CalculateVMRowAndSwath() warn: inconsistent indenting drivers/gpu/drm/amd/amdgpu/../display/dc/dml2/display_mode_core.c:6013 CalculatePrefetchBandwithSupport() warn: inconsistent indenting drivers/gpu/drm/amd/amdgpu/../display/dc/dml2/display_mode_core.c:6195 CalculateMaxVStartup() warn: inconsistent indenting drivers/gpu/drm/amd/amdgpu/../display/dc/dml2/display_mode_core.c:6916 dml_core_mode_support() warn: inconsistent indenting drivers/gpu/drm/amd/amdgpu/../display/dc/dml2/display_mode_core.c:7206 dml_core_mode_support() warn: inconsistent indenting drivers/gpu/drm/amd/amdgpu/../display/dc/dml2/display_mode_core.c:7455 dml_core_mode_support() warn: inconsistent indenting drivers/gpu/drm/amd/amdgpu/../display/dc/dml2/display_mode_core.c:7869 dml_core_mode_support() warn: inconsistent indenting drivers/gpu/drm/amd/amdgpu/../display/dc/dml2/display_mode_core.c:7940 dml_core_mode_support() warn: inconsistent indenting drivers/gpu/drm/amd/amdgpu/../display/dc/dml2/display_mode_core.c:8366 dml_core_mode_programming() warn: inconsistent indenting drivers/gpu/drm/amd/amdgpu/../display/dc/dml2/display_mode_core.c:9345 dml_core_mode_programming() warn: for statement not indented drivers/gpu/drm/amd/amdgpu/../display/dc/dml2/display_mode_util.c:116 dml_floor() warn: if statement not indented drivers/gpu/drm/amd/amdgpu/../display/dc/dml2/display_mode_util.c:150 dml_max() warn: inconsistent indenting drivers/gpu/drm/amd/amdgpu/../display/dc/dml2/display_mode_util.c:731 dml_get_num_active_planes() warn: if statement not indented drivers/gpu/drm/amd/amdgpu/../display/dc/dml2/dml2_mall_phantom.c:459 dml2_svp_drr_schedulable() error: we previously assumed 'pipe->stream' could be null (see line 450) drivers/gpu/drm/amd/amdgpu/../display/dc/dml2/dml2_mall_phantom.c:549 subvp_vblank_schedulable() error: we previously assumed 'subvp_pipe' could be null (see line 541) drivers/gpu/drm/amd/amdgpu/../display/dc/dml2/dml2_mall_phantom.c:549 subvp_vblank_schedulable() warn: pointer dereferenced without being set 'subvp_pipe' drivers/gpu/drm/amd/amdgpu/../display/dc/dml2/dml2_policy.c:206 dml2_policy_build_synthetic_soc_states() warn: inconsistent indenting drivers/gpu/drm/amd/amdgpu/../display/dc/dml2/dml2_translation_helper.c:604 populate_dml_output_cfg_from_stream_state() warn: ignoring unreachable code. drivers/gpu/drm/amd/amdgpu/../display/dc/dml2/dml2_wrapper.c:137 optimize_configuration() warn: inconsistent indenting drivers/gpu/drm/amd/amdgpu/../display/dc/hwss/dce110/dce110_hwseq.c:1014 dce110_edp_backlight_control() error: we previously assumed 'link->panel_cntl' could be null (see line 971) drivers/gpu/drm/amd/amdgpu/../display/dc/hwss/dcn10/dcn10_hwseq.c:1495 dcn10_init_hw() error: we previously assumed 'dc->clk_mgr' could be null (see line 1491) drivers/gpu/drm/amd/amdgpu/../display/dc/hwss/dcn10/dcn10_hwseq.c:1858 dcn10_set_output_transfer_func() warn: variable dereferenced before check 'stream' (see line 1841) drivers/gpu/drm/amd/amdgpu/../display/dc/hwss/dcn201/dcn201_hwseq.c:240 dcn201_init_hw() warn: variable dereferenced before check 'res_pool->dccg' (see line 228) drivers/gpu/drm/amd/amdgpu/../display/dc/hwss/dcn20/dcn20_hwseq.c:1803 dcn20_program_pipe() error: we previously assumed 'pipe_ctx->plane_state' could be null (see line 1762) drivers/gpu/drm/amd/amdgpu/../display/dc/hwss/dcn20/dcn20_hwseq.c:2080 dcn20_post_unlock_program_front_end() error: we previously assumed 'hwseq' could be null (see line 2074) drivers/gpu/drm/amd/amdgpu/../display/dc/hwss/dcn20/dcn20_hwseq.c:851 dcn20_enable_stream_timing() warn: variable dereferenced before check 'pipe_ctx->stream_res.tg' (see line 758) drivers/gpu/drm/amd/amdgpu/../display/dc/hwss/dcn21/dcn21_hwseq.c:249 dcn21_set_backlight_level() error: we previously assumed 'panel_cntl' could be null (see line 238) drivers/gpu/drm/amd/amdgpu/../display/dc/hwss/dcn30/dcn30_hwseq.c:510 dcn30_init_hw() warn: variable dereferenced before check 'res_pool->dccg' (see line 480) drivers/gpu/drm/amd/amdgpu/../display/dc/hwss/dcn30/dcn30_hwseq.c:635 dcn30_init_hw() error: we previously assumed 'dc->clk_mgr' could be null (see line 476) drivers/gpu/drm/amd/amdgpu/../display/dc/hwss/dcn30/dcn30_hwseq.c:777 dcn30_apply_idle_power_optimizations() error: we previously assumed 'stream' could be null (see line 761) drivers/gpu/drm/amd/amdgpu/../display/dc/hwss/dcn30/dcn30_hwseq.c:779 dcn30_apply_idle_power_optimizations() error: we previously assumed 'plane' could be null (see line 761) drivers/gpu/drm/amd/amdgpu/../display/dc/hwss/dcn31/dcn31_hwseq.c:135 dcn31_init_hw() warn: variable dereferenced before check 'res_pool->dccg' (see line 126) drivers/gpu/drm/amd/amdgpu/../display/dc/hwss/dcn31/dcn31_hwseq.c:257 dcn31_init_hw() error: we previously assumed 'dc->clk_mgr' could be null (see line 117) drivers/gpu/drm/amd/amdgpu/../display/dc/hwss/dcn32/dcn32_hwseq.c:266 dcn32_apply_idle_power_optimizations() warn: variable dereferenced before check 'dc->current_state' (see line 258) drivers/gpu/drm/amd/amdgpu/../display/dc/hwss/dcn32/dcn32_hwseq.c:802 dcn32_init_hw() warn: variable dereferenced before check 'res_pool->dccg' (see line 779) drivers/gpu/drm/amd/amdgpu/../display/dc/hwss/dcn32/dcn32_hwseq.c:952 dcn32_init_hw() error: we previously assumed 'dc->clk_mgr' could be null (see line 775) drivers/gpu/drm/amd/amdgpu/../display/dc/hwss/dcn35/dcn35_hwseq.c:159 dcn35_init_hw() warn: variable dereferenced before check 'res_pool->dccg' (see line 150) drivers/gpu/drm/amd/amdgpu/../display/dc/hwss/dcn35/dcn35_hwseq.c:206 dcn35_init_hw() error: we previously assumed 'res_pool->hubbub' could be null (see line 159) drivers/gpu/drm/amd/amdgpu/../display/dc/hwss/dcn35/dcn35_hwseq.c:285 dcn35_init_hw() error: we previously assumed 'dc->clk_mgr' could be null (see line 136) drivers/gpu/drm/amd/amdgpu/../display/dc/hwss/dcn35/dcn35_hwseq.c:973 dcn35_calc_blocks_to_gate() error: we previously assumed 'pipe_ctx->plane_res.hubp' could be null (see line 969) drivers/gpu/drm/amd/amdgpu/../display/dc/hwss/dcn35/dcn35_hwseq.c:976 dcn35_calc_blocks_to_gate() warn: always true condition '(pipe_ctx->plane_res.mpcc_inst >= 0) => (0-255 >= 0)' regards, dan carpenter