]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
drm/amd/display: Add clk_mgr NULL checks in dcn32_initialize_min_clocks()
authorSrinivasan Shanmugam <srinivasan.shanmugam@amd.com>
Sun, 15 Mar 2026 14:41:54 +0000 (20:11 +0530)
committerAlex Deucher <alexander.deucher@amd.com>
Mon, 23 Mar 2026 18:18:14 +0000 (14:18 -0400)
commitb4a8a2aba4e3a02ebbf8d2708fcafd491ebd4644
treec04a362b8cd935c953cf63561ad24539ea9a36ae
parentbf39c461ada3f81e2cae487a402c03ce282a545c
drm/amd/display: Add clk_mgr NULL checks in dcn32_initialize_min_clocks()

dcn32_init_hw() checks dc->clk_mgr before calling init_clocks(), so the
clock manager is not treated as unconditionally present on this path.
However, dcn32_initialize_min_clocks() later dereferences dc->clk_mgr,
bw_params, and clk_mgr callbacks without validating them.

Add the required guards in dcn32_initialize_min_clocks() before
accessing clk_mgr-dependent state, and check callback presence before
calling get_dispclk_from_dentist() and update_clocks().

Also guard the later update_bw_bounding_box() call in the FAMS2-disabled
path since it also dereferences dc->clk_mgr->bw_params.

This keeps clk_mgr handling consistent in the DCN32 HW init flow and
avoids possible NULL pointer dereferences reported by Smatch.

Fixes the below:
drivers/gpu/drm/amd/amdgpu/../display/dc/hwss/dcn32/dcn32_hwseq.c:1012 dcn32_init_hw() error: we previously assumed 'dc->clk_mgr' could be null (see line 978)

Cc: Roman Li <roman.li@amd.com>
Cc: Alex Hung <alex.hung@amd.com>
Cc: Jerry Zuo <jerry.zuo@amd.com>
Cc: Sun peng Li <sunpeng.li@amd.com>
Cc: Tom Chung <chiahsuan.chung@amd.com>
Cc: Dan Carpenter <dan.carpenter@linaro.org>
Cc: Aurabindo Pillai <aurabindo.pillai@amd.com>
Signed-off-by: Srinivasan Shanmugam <srinivasan.shanmugam@amd.com>
Reviewed-by: Alex Hung <alex.hung@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/display/dc/hwss/dcn32/dcn32_hwseq.c