diff options
author | Bernard Zhao <bernard@vivo.com> | 2021-11-15 04:09:06 -0800 |
---|---|---|
committer | Alex Deucher <alexander.deucher@amd.com> | 2021-11-22 14:45:02 -0500 |
commit | 8b11e14bd5793cd0e5cb65055fe51588a779f05b (patch) | |
tree | 21f13da8b1a8b9b678f9d483f64d59fe75554b07 /drivers/gpu/drm | |
parent | 7b755d65100eacb63f81c35addbdb0a0ef5806b3 (diff) | |
download | linux-stable-8b11e14bd5793cd0e5cb65055fe51588a779f05b.tar.gz linux-stable-8b11e14bd5793cd0e5cb65055fe51588a779f05b.tar.bz2 linux-stable-8b11e14bd5793cd0e5cb65055fe51588a779f05b.zip |
drm/amd/amdgpu: cleanup the code style a bit
This change is to cleanup the code style a bit.
Signed-off-by: Bernard Zhao <bernard@vivo.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'drivers/gpu/drm')
-rw-r--r-- | drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c index 04cf9b207e62..3fc49823f527 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c @@ -283,17 +283,15 @@ static int amdgpu_virt_init_ras_err_handler_data(struct amdgpu_device *adev) *data = kmalloc(sizeof(struct amdgpu_virt_ras_err_handler_data), GFP_KERNEL); if (!*data) - return -ENOMEM; + goto data_failure; bps = kmalloc_array(align_space, sizeof((*data)->bps), GFP_KERNEL); - bps_bo = kmalloc_array(align_space, sizeof((*data)->bps_bo), GFP_KERNEL); + if (!bps) + goto bps_failure; - if (!bps || !bps_bo) { - kfree(bps); - kfree(bps_bo); - kfree(*data); - return -ENOMEM; - } + bps_bo = kmalloc_array(align_space, sizeof((*data)->bps_bo), GFP_KERNEL); + if (!bps_bo) + goto bps_bo_failure; (*data)->bps = bps; (*data)->bps_bo = bps_bo; @@ -303,6 +301,13 @@ static int amdgpu_virt_init_ras_err_handler_data(struct amdgpu_device *adev) virt->ras_init_done = true; return 0; + +bps_bo_failure: + kfree(bps); +bps_failure: + kfree(*data); +data_failure: + return -ENOMEM; } static void amdgpu_virt_ras_release_bp(struct amdgpu_device *adev) |