Skip to content

Commit

Permalink
drm/amdgpu: Fix memory leaks at amdgpu_init() error path
Browse files Browse the repository at this point in the history
amdgpu driver checks vgacon_text_force() after some initializations
but without cleaning up.  This will result in leaks.

Move the check of vgacon_text_force() to the beginning of
amdgpu_init() for fixing it and also for optimization.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
  • Loading branch information
Takashi Iwai authored and Alex Deucher committed Apr 3, 2018
1 parent 41212e2 commit c60e22f
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
Original file line number Diff line number Diff line change
Expand Up @@ -922,6 +922,11 @@ static int __init amdgpu_init(void)
{
int r;

if (vgacon_text_force()) {
DRM_ERROR("VGACON disables amdgpu kernel modesetting.\n");
return -EINVAL;
}

r = amdgpu_sync_init();
if (r)
goto error_sync;
Expand All @@ -930,10 +935,6 @@ static int __init amdgpu_init(void)
if (r)
goto error_fence;

if (vgacon_text_force()) {
DRM_ERROR("VGACON disables amdgpu kernel modesetting.\n");
return -EINVAL;
}
DRM_INFO("amdgpu kernel modesetting enabled.\n");
driver = &kms_driver;
pdriver = &amdgpu_kms_pci_driver;
Expand Down

0 comments on commit c60e22f

Please sign in to comment.