diff options
author | Takashi Iwai <tiwai@suse.de> | 2018-03-30 16:45:11 -0400 |
---|---|---|
committer | Alex Deucher <alexander.deucher@amd.com> | 2018-04-03 14:08:46 -0400 |
commit | c60e22f7199b5fe7cee4007ccb3b27bb8a506476 (patch) | |
tree | 2701d0ed3e88ce4dade4175ba5da665aa4c0a5fd /drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | |
parent | 41212e2fe72b26ded7ed78224d9eab720c2891e2 (diff) |
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 <tiwai@suse.de>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c')
-rw-r--r-- | drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c index 7379aa5a6849..0b19482b36b8 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | |||
@@ -922,6 +922,11 @@ static int __init amdgpu_init(void) | |||
922 | { | 922 | { |
923 | int r; | 923 | int r; |
924 | 924 | ||
925 | if (vgacon_text_force()) { | ||
926 | DRM_ERROR("VGACON disables amdgpu kernel modesetting.\n"); | ||
927 | return -EINVAL; | ||
928 | } | ||
929 | |||
925 | r = amdgpu_sync_init(); | 930 | r = amdgpu_sync_init(); |
926 | if (r) | 931 | if (r) |
927 | goto error_sync; | 932 | goto error_sync; |
@@ -930,10 +935,6 @@ static int __init amdgpu_init(void) | |||
930 | if (r) | 935 | if (r) |
931 | goto error_fence; | 936 | goto error_fence; |
932 | 937 | ||
933 | if (vgacon_text_force()) { | ||
934 | DRM_ERROR("VGACON disables amdgpu kernel modesetting.\n"); | ||
935 | return -EINVAL; | ||
936 | } | ||
937 | DRM_INFO("amdgpu kernel modesetting enabled.\n"); | 938 | DRM_INFO("amdgpu kernel modesetting enabled.\n"); |
938 | driver = &kms_driver; | 939 | driver = &kms_driver; |
939 | pdriver = &amdgpu_kms_pci_driver; | 940 | pdriver = &amdgpu_kms_pci_driver; |