summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLiu ChengZhe <ChengZhe.Liu@amd.com>2020-06-09 16:44:43 +0800
committerAlex Deucher <alexander.deucher@amd.com>2020-07-01 01:59:18 -0400
commit7504d3bbec7da70516a13e34415b92bf5203399a (patch)
tree4aac5a7054c6a031f7848819dfec79c75a2b2a0e
parent10eafd3e56fde46869d8f46d19c2dc80bdd23bba (diff)
drm/amd/amdgpu: handle return value of amdgpu_driver_load_kms
if guest driver failed to enter full GPU access, amdgpu_driver_load_kms will unload kms and free dev->dev_private, drm_dev_register would access null pointer. Driver will enter an error state and can't be unloaded. Signed-off-by: Liu ChengZhe <ChengZhe.Liu@amd.com> Reviewed-by: Madhav Chauhan <madhav.chauhan@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
-rw-r--r--drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
index 126e74758a34..75bcd1789185 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
@@ -1111,7 +1111,9 @@ static int amdgpu_pci_probe(struct pci_dev *pdev,
pci_set_drvdata(pdev, dev);
- amdgpu_driver_load_kms(dev, ent->driver_data);
+ ret = amdgpu_driver_load_kms(dev, ent->driver_data);
+ if (ret)
+ goto err_pci;
retry_init:
ret = drm_dev_register(dev, ent->driver_data);