mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-05 02:21:52 +09:00
drm/amdgpu: handle amdgpu_cgs_create_device() errors in amd_powerplay_create()
[ Upstream commit 1435e895d4fc967d64e9f5bf81e992ac32f5ac76 ] 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> Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
dd686b699b
commit
55ef52c30c
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user