mirror of
https://github.com/torvalds/linux.git
synced 2026-05-25 15:41:52 +02:00
drm/amdgpu: handle amdgpu_cgs_create_device() errors in amd_powerplay_create()
Add error handling to propagate amdgpu_cgs_create_device() failures to the caller. When amdgpu_cgs_create_device() fails, release hwmgr and return -ENOMEM to prevent null pointer dereference. [v1]->[v2]: Change error code from -EINVAL to -ENOMEM. Free hwmgr. Signed-off-by: Wentao Liang <vulab@iscas.ac.cn> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
This commit is contained in:
parent
bd4b125eb9
commit
1435e895d4
|
|
@ -51,6 +51,11 @@ static int amd_powerplay_create(struct amdgpu_device *adev)
|
|||
hwmgr->adev = adev;
|
||||
hwmgr->not_vf = !amdgpu_sriov_vf(adev);
|
||||
hwmgr->device = amdgpu_cgs_create_device(adev);
|
||||
if (!hwmgr->device) {
|
||||
kfree(hwmgr);
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
mutex_init(&hwmgr->msg_lock);
|
||||
hwmgr->chip_family = adev->family;
|
||||
hwmgr->chip_id = adev->asic_type;
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user