drm/amd/display: Register DCN as a PMFW DF C-state client on DCN42
Hello Leo Chen,
Commit 53845307d52e ("drm/amd/display: Register DCN as a PMFW DF C-state client on DCN42") from Jul 9, 2026, leads to the following Smatch complaint:
drivers/gpu/drm/amd/amdgpu/../display/dc/hwss/dcn42/dcn42_hwseq.c:686 dcn42_prepare_bandwidth()
warn: variable dereferenced before check 'dc->clk_mgr' (see line 681)drivers/gpu/drm/amd/amdgpu/../display/dc/hwss/dcn42/dcn42_hwseq.c
680
681 dcn401_prepare_bandwidth(dc, context);
^^dc->clk_mgr is dereferenced here.
682
683 /* valid C-state watermarks have now been committed to HW, so it
684 * is safe to vote "allow" to PMFW.
685 */
686 if (dc->clk_mgr && dc->clk_mgr->funcs && dc->clk_mgr->funcs->notify_cstate_disable)
^^^^^^^^^^^
so this check is too late.
687 dc->clk_mgr->funcs->notify_cstate_disable(dc->clk_mgr, false); 688 }
This email is a free service from the Smatch-CI project [smatch.sf.net].
regards,
dan carpenter
Quoted 15 lines · Dan Carpenter
Hello Leo Chen,
Commit
53845307d52e("drm/amd/display: Register DCN as a PMFW DF C-state client on DCN42") from Jul 9, 2026, leads to the following Smatch complaint:drivers/gpu/drm/amd/amdgpu/../display/dc/hwss/dcn42/dcn42_hwseq.c:686 dcn42_prepare_bandwidth() warn: variable dereferenced before check 'dc->clk_mgr' (see line 681)
drivers/gpu/drm/amd/amdgpu/../display/dc/hwss/dcn42/dcn42_hwseq.c
680681 dcn401_prepare_bandwidth(dc, context); ^^
dc->clk_mgris dereferenced here.
Quoted 8 lines
682 683 /* valid C-state watermarks have now been committed to HW, so it 684 * is safe to vote "allow" to PMFW. 685 */ 686 if (dc->clk_mgr && dc->clk_mgr->funcs && dc->clk_mgr->funcs->notify_cstate_disable) ^^^^^^^^^^^so this check is too late.
Actually, dc->clk_mgr->funcs is dereferenced as well.
regards,
dan carpenter