提交 c60e22f7 编写于 作者: T Takashi Iwai 提交者: Alex Deucher

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: NTakashi Iwai <tiwai@suse.de>
Signed-off-by: NAlex Deucher <alexander.deucher@amd.com>
上级 41212e2f
...@@ -922,6 +922,11 @@ static int __init amdgpu_init(void) ...@@ -922,6 +922,11 @@ static int __init amdgpu_init(void)
{ {
int r; int r;
if (vgacon_text_force()) {
DRM_ERROR("VGACON disables amdgpu kernel modesetting.\n");
return -EINVAL;
}
r = amdgpu_sync_init(); r = amdgpu_sync_init();
if (r) if (r)
goto error_sync; goto error_sync;
...@@ -930,10 +935,6 @@ static int __init amdgpu_init(void) ...@@ -930,10 +935,6 @@ static int __init amdgpu_init(void)
if (r) if (r)
goto error_fence; goto error_fence;
if (vgacon_text_force()) {
DRM_ERROR("VGACON disables amdgpu kernel modesetting.\n");
return -EINVAL;
}
DRM_INFO("amdgpu kernel modesetting enabled.\n"); DRM_INFO("amdgpu kernel modesetting enabled.\n");
driver = &kms_driver; driver = &kms_driver;
pdriver = &amdgpu_kms_pci_driver; pdriver = &amdgpu_kms_pci_driver;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册