Skip to content

Commit edec9b0

Browse files
jiangliualexdeucher
authored andcommitted
drm/amdgpu: wrong array index to get ip block for PSP
The adev->ip_blocks array is not indexed by AMD_IP_BLOCK_TYPE_xxx, instead we should call amdgpu_device_ip_get_ip_block() to get the corresponding IP block oject. Fix some checkpatch issues (Alex) Signed-off-by: Jiang Liu <[email protected]> Signed-off-by: Alex Deucher <[email protected]>
1 parent 60a2c0c commit edec9b0

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3891,10 +3891,12 @@ static ssize_t psp_usbc_pd_fw_sysfs_read(struct device *dev,
38913891
{
38923892
struct drm_device *ddev = dev_get_drvdata(dev);
38933893
struct amdgpu_device *adev = drm_to_adev(ddev);
3894+
struct amdgpu_ip_block *ip_block;
38943895
uint32_t fw_ver;
38953896
int ret;
38963897

3897-
if (!adev->ip_blocks[AMD_IP_BLOCK_TYPE_PSP].status.late_initialized) {
3898+
ip_block = amdgpu_device_ip_get_ip_block(adev, AMD_IP_BLOCK_TYPE_PSP);
3899+
if (!ip_block || !ip_block->status.late_initialized) {
38983900
dev_info(adev->dev, "PSP block is not ready yet\n.");
38993901
return -EBUSY;
39003902
}
@@ -3923,8 +3925,10 @@ static ssize_t psp_usbc_pd_fw_sysfs_write(struct device *dev,
39233925
struct amdgpu_bo *fw_buf_bo = NULL;
39243926
uint64_t fw_pri_mc_addr;
39253927
void *fw_pri_cpu_addr;
3928+
struct amdgpu_ip_block *ip_block;
39263929

3927-
if (!adev->ip_blocks[AMD_IP_BLOCK_TYPE_PSP].status.late_initialized) {
3930+
ip_block = amdgpu_device_ip_get_ip_block(adev, AMD_IP_BLOCK_TYPE_PSP);
3931+
if (!ip_block || !ip_block->status.late_initialized) {
39283932
dev_err(adev->dev, "PSP block is not ready yet.");
39293933
return -EBUSY;
39303934
}

0 commit comments

Comments
 (0)