Skip to content

Commit

Permalink
drm/amd/amdgpu: cleanup the code style a bit
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Bernard Zhao authored and Alex Deucher committed Nov 22, 2021
1 parent 7b755d6 commit 8b11e14
Showing 1 changed file with 13 additions and 8 deletions.
21 changes: 13 additions & 8 deletions drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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)
Expand Down

0 comments on commit 8b11e14

Please sign in to comment.