Skip to content

Commit c60e22f

Browse files
tiwaialexdeucher
authored andcommitted
drm/amdgpu: Fix memory leaks at amdgpu_init() error path
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 <[email protected]> Signed-off-by: Alex Deucher <[email protected]>
1 parent 41212e2 commit c60e22f

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -922,6 +922,11 @@ static int __init amdgpu_init(void)
922922
{
923923
int r;
924924

925+
if (vgacon_text_force()) {
926+
DRM_ERROR("VGACON disables amdgpu kernel modesetting.\n");
927+
return -EINVAL;
928+
}
929+
925930
r = amdgpu_sync_init();
926931
if (r)
927932
goto error_sync;
@@ -930,10 +935,6 @@ static int __init amdgpu_init(void)
930935
if (r)
931936
goto error_fence;
932937

933-
if (vgacon_text_force()) {
934-
DRM_ERROR("VGACON disables amdgpu kernel modesetting.\n");
935-
return -EINVAL;
936-
}
937938
DRM_INFO("amdgpu kernel modesetting enabled.\n");
938939
driver = &kms_driver;
939940
pdriver = &amdgpu_kms_pci_driver;

0 commit comments

Comments
 (0)