Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

drm/amdgpu: Plus NULL function pointer check

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Evan Quan <evan.quan@amd.com>
Signed-off-by: Rex Zhu <Rex.Zhu@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>

authored by

Rex Zhu and committed by
Alex Deucher
57716327 8e686279

+6 -3
+6 -3
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
··· 1417 1417 continue; 1418 1418 /* skip CG for VCE/UVD, it's handled specially */ 1419 1419 if (adev->ip_blocks[i].version->type != AMD_IP_BLOCK_TYPE_UVD && 1420 - adev->ip_blocks[i].version->type != AMD_IP_BLOCK_TYPE_VCE) { 1420 + adev->ip_blocks[i].version->type != AMD_IP_BLOCK_TYPE_VCE && 1421 + adev->ip_blocks[i].version->funcs->set_clockgating_state) { 1421 1422 /* enable clockgating to save power */ 1422 1423 r = adev->ip_blocks[i].version->funcs->set_clockgating_state((void *)adev, 1423 1424 AMD_CG_STATE_GATE); ··· 1467 1466 for (i = 0; i < adev->num_ip_blocks; i++) { 1468 1467 if (!adev->ip_blocks[i].status.hw) 1469 1468 continue; 1470 - if (adev->ip_blocks[i].version->type == AMD_IP_BLOCK_TYPE_SMC) { 1469 + if (adev->ip_blocks[i].version->type == AMD_IP_BLOCK_TYPE_SMC && 1470 + adev->ip_blocks[i].version->funcs->set_clockgating_state) { 1471 1471 /* ungate blocks before hw fini so that we can shutdown the blocks safely */ 1472 1472 r = adev->ip_blocks[i].version->funcs->set_clockgating_state((void *)adev, 1473 1473 AMD_CG_STATE_UNGATE); ··· 1580 1578 if (!adev->ip_blocks[i].status.valid) 1581 1579 continue; 1582 1580 /* ungate blocks so that suspend can properly shut them down */ 1583 - if (i != AMD_IP_BLOCK_TYPE_SMC) { 1581 + if (i != AMD_IP_BLOCK_TYPE_SMC && 1582 + adev->ip_blocks[i].version->funcs->set_clockgating_state) { 1584 1583 r = adev->ip_blocks[i].version->funcs->set_clockgating_state((void *)adev, 1585 1584 AMD_CG_STATE_UNGATE); 1586 1585 if (r) {