[bug report] drm/amd/display: Allow Z8 when stutter threshold is not met

Dan Carpenter dan.carpenter at linaro.org
Fri Apr 5 10:10:03 UTC 2024


Hello Bhawanpreet Lakha,

This is a semi-automatic email about new static checker warnings.

Commit e9a09a198bfe ("drm/amd/display: Allow Z8 when stutter
threshold is not met") from Mar 13, 2024, leads to the following
Smatch complaint:

    drivers/gpu/drm/amd/amdgpu/../display/dc/dml/dcn20/dcn20_fpu.c:1088 decide_zstate_support()
    warn: variable dereferenced before check 'link' (see line 1087)

drivers/gpu/drm/amd/amdgpu/../display/dc/dml/dcn20/dcn20_fpu.c
  1086			bool allow_z8 = context->bw_ctx.dml.vba.StutterPeriod > (double)minmum_z8_residency;
  1087			bool is_pwrseq0 = link->link_index == 0;
                                          ^^^^^^^^^^^^^^^^
The existing code assumes link isn't NULL

  1088			bool is_psr = (link && (link->psr_settings.psr_version == DC_PSR_VERSION_1 ||
                                       ^^^^
  1089							link->psr_settings.psr_version == DC_PSR_VERSION_SU_1) && !link->panel_config.psr.disable_psr);
  1090			bool is_replay = link && link->replay_settings.replay_feature_enabled;
                                         ^^^^
but the patch assumes link can be NULL.  Somebody is wrong.

regards,
dan carpenter


More information about the amd-gfx mailing list