On Mon, Sep 14, 2026 at 01:21:43PM +0300, Dan Carpenter wrote:
> 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.
>
Actually, dc->clk_mgr->funcs is dereferenced as well.
regards,
dan carpenter