]> git.baikalelectronics.ru Git - kernel.git/commit
drm/amd/display: Use switch table for dc_to_smu_clock_type
authorLeo Li <sunpeng.li@amd.com>
Thu, 25 Jul 2019 17:12:24 +0000 (13:12 -0400)
committerAlex Deucher <alexander.deucher@amd.com>
Fri, 2 Aug 2019 15:17:57 +0000 (10:17 -0500)
commit7fcd92cd0667142b10fbcf618f884153e0baa273
tree64d014186479a744d13d79d53db5435b68b40ada
parent22ead1e2f5e4d27e90ef7651a075e7090b176a62
drm/amd/display: Use switch table for dc_to_smu_clock_type

Using a static int array will cause errors if the given dm_pp_clk_type
is out-of-bounds. For robustness, use a switch table, with a default
case to handle all invalid values.

v2: 0 is a valid clock type for smu_clk_type. Return SMU_CLK_COUNT
    instead on invalid mapping.

Signed-off-by: Leo Li <sunpeng.li@amd.com>
Reviewed-by: Nicholas Kazlauskas <nicholas.kazlauskas@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_pp_smu.c