mirror of
https://github.com/torvalds/linux.git
synced 2026-05-24 07:03:03 +02:00
drm/amdgpu: Fix uninitialized variable warning in amdgpu_info_ioctl
Check the return value of amdgpu_xcp_get_inst_details, otherwise we may use an uninitialized variable inst_mask Signed-off-by: Ma Jun <Jun.Ma2@amd.com> Acked-by: Alex Deucher <alexander.deucher@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
This commit is contained in:
parent
d768394fa9
commit
0991e49d2b
|
|
@ -623,25 +623,32 @@ int amdgpu_info_ioctl(struct drm_device *dev, void *data, struct drm_file *filp)
|
|||
switch (type) {
|
||||
case AMD_IP_BLOCK_TYPE_GFX:
|
||||
ret = amdgpu_xcp_get_inst_details(xcp, AMDGPU_XCP_GFX, &inst_mask);
|
||||
if (ret)
|
||||
return ret;
|
||||
count = hweight32(inst_mask);
|
||||
break;
|
||||
case AMD_IP_BLOCK_TYPE_SDMA:
|
||||
ret = amdgpu_xcp_get_inst_details(xcp, AMDGPU_XCP_SDMA, &inst_mask);
|
||||
if (ret)
|
||||
return ret;
|
||||
count = hweight32(inst_mask);
|
||||
break;
|
||||
case AMD_IP_BLOCK_TYPE_JPEG:
|
||||
ret = amdgpu_xcp_get_inst_details(xcp, AMDGPU_XCP_VCN, &inst_mask);
|
||||
if (ret)
|
||||
return ret;
|
||||
count = hweight32(inst_mask) * adev->jpeg.num_jpeg_rings;
|
||||
break;
|
||||
case AMD_IP_BLOCK_TYPE_VCN:
|
||||
ret = amdgpu_xcp_get_inst_details(xcp, AMDGPU_XCP_VCN, &inst_mask);
|
||||
if (ret)
|
||||
return ret;
|
||||
count = hweight32(inst_mask);
|
||||
break;
|
||||
default:
|
||||
return -EINVAL;
|
||||
}
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
return copy_to_user(out, &count, min(size, 4u)) ? -EFAULT : 0;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user