Skip to content

Commit

Permalink
drm/amdgpu: add some error handling to amdgpu_init v2
Browse files Browse the repository at this point in the history
Just to be clean should we ever run into -ENOMEM during module init.

v2: fix typo in commit message

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com> (v1)
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
  • Loading branch information
Christian König authored and Alex Deucher committed Oct 31, 2016
1 parent c24784f commit 245ae5e
Showing 1 changed file with 23 additions and 3 deletions.
26 changes: 23 additions & 3 deletions drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
Original file line number Diff line number Diff line change
Expand Up @@ -735,9 +735,20 @@ static struct pci_driver amdgpu_kms_pci_driver = {

static int __init amdgpu_init(void)
{
amdgpu_sync_init();
amdgpu_fence_slab_init();
amd_sched_fence_slab_init();
int r;

r = amdgpu_sync_init();
if (r)
goto error_sync;

r = amdgpu_fence_slab_init();
if (r)
goto error_fence;

r = amd_sched_fence_slab_init();
if (r)
goto error_sched;

if (vgacon_text_force()) {
DRM_ERROR("VGACON disables amdgpu kernel modesetting.\n");
return -EINVAL;
Expand All @@ -749,6 +760,15 @@ static int __init amdgpu_init(void)
amdgpu_register_atpx_handler();
/* let modprobe override vga console setting */
return drm_pci_init(driver, pdriver);

error_sched:
amdgpu_fence_slab_fini();

error_fence:
amdgpu_sync_fini();

error_sync:
return r;
}

static void __exit amdgpu_exit(void)
Expand Down

0 comments on commit 245ae5e

Please sign in to comment.