drm/amd/pm: avoid potential UBSAN issue on legacy asics
authorGuchun Chen <guchun.chen@amd.com>
Tue, 9 May 2023 01:36:49 +0000 (09:36 +0800)
committerAlex Deucher <alexander.deucher@amd.com>
Thu, 11 May 2023 12:41:36 +0000 (08:41 -0400)
commit5247f05eadf1081a74b2233f291cee2efed25e3a
tree00e61946dff037675d4b9fbc5f33c2d746491c0b
parent8b229ada2669b74fdae06c83fbfda5a5a99fc253
drm/amd/pm: avoid potential UBSAN issue on legacy asics

Prevent further dpm casting on legacy asics without od_enabled in
amdgpu_dpm_is_overdrive_supported. This can avoid UBSAN complain
in init sequence.

v2: add a macro to check legacy dpm instead of checking asic family/type
v3: refine macro name for naming consistency

Suggested-by: Evan Quan <evan.quan@amd.com>
Signed-off-by: Guchun Chen <guchun.chen@amd.com>
Reviewed-by: Lijo Lazar <lijo.lazar@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Cc: stable@vger.kernel.org
drivers/gpu/drm/amd/pm/amdgpu_dpm.c