Hello Bhawanpreet Lakha,
The patch c7ddc0a800bc: "drm/amd/display: Add Functions to enable
Freesync Panel Replay" from May 12, 2023 (linux-next), leads to the
following Smatch static checker warning:
drivers/gpu/drm/amd/amdgpu/../display/dc/link/protocols/link_edp_panel_control.c:849
edp_set_replay_allow_active()
error: we previously assumed 'replay' could be null (see line 841)
drivers/gpu/drm/amd/amdgpu/../display/dc/link/protocols/link_edp_panel_control.c:932
edp_setup_replay()
warn: duplicate check 'replay' (previous on line 904)
drivers/gpu/drm/amd/amdgpu/../display/dc/link/protocols/link_edp_panel_control.c
834 bool edp_set_replay_allow_active(struct dc_link *link, const bool
*allow_active,
835 bool wait, bool force_static, const unsigned int *power_opts)
836 {
837 struct dc *dc = link->ctx->dc;
838 struct dmub_replay *replay = dc->res_pool->replay;
839 unsigned int panel_inst;
840
841 if (replay == NULL && force_static)
replay is allow to be NULL if force_static is false.
842 return false;
843
844 if (!dc_get_edp_link_panel_inst(dc, link, &panel_inst))
845 return false;
846
847 /* Set power optimization flag */
848 if (power_opts && link->replay_settings.replay_power_opt_active
!= *power_opts) {
--> 849 if (link->replay_settings.replay_feature_enabled &&
replay->funcs->replay_set_power_opt) {
^^^^^^^^
Unchecked dereference.
850 replay->funcs->replay_set_power_opt(replay,
*power_opts, panel_inst);
851 link->replay_settings.replay_power_opt_active =
*power_opts;
852 }
853 }
854
855 /* Activate or deactivate Replay */
856 if (allow_active && link->replay_settings.replay_allow_active
!= *allow_active) {
857 // TODO: Handle mux change case if force_static is set
858 // If force_static is set, just change the
replay_allow_active state directly
859 if (replay != NULL &&
link->replay_settings.replay_feature_enabled)
860 replay->funcs->replay_enable(replay,
*allow_active, wait, panel_inst);
861 link->replay_settings.replay_allow_active =
*allow_active;
862 }
863
864 return true;
865 }
regards,
dan carpenter