]> git.proxmox.com Git - mirror_ubuntu-eoan-kernel.git/commitdiff
drm/amdgpu: Fix memory leaks at amdgpu_init() error path
authorTakashi Iwai <tiwai@suse.de>
Fri, 30 Mar 2018 20:45:11 +0000 (22:45 +0200)
committerAlex Deucher <alexander.deucher@amd.com>
Tue, 3 Apr 2018 18:08:46 +0000 (13:08 -0500)
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>
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c

index 7379aa5a684941fba95e5875654fb53bc717936c..0b19482b36b8a3dab3b052fdf8b6f1826acca451 100644 (file)
@@ -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;
@@ -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;