I hit this when compiling amdgpu in kernel. amdgpu_driver_load_kms fail
to load firmwares since GPU was initialized before rootfs is ready.
Just gracefully fail in such cases.

Signed-off-by: Lepton Wu <ytht....@gmail.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 3 ++-
 drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c | 2 ++
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c 
b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
index 126e74758a34..f9d277f8ddd4 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
@@ -1124,7 +1124,8 @@ static int amdgpu_pci_probe(struct pci_dev *pdev,
                goto err_pci;
 
        adev = dev->dev_private;
-       ret = amdgpu_debugfs_init(adev);
+       if (adev)
+               ret = amdgpu_debugfs_init(adev);
        if (ret)
                DRM_ERROR("Creating debugfs files failed (%d).\n", ret);
 
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c 
b/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c
index d7e17e34fee1..99a6ec49ead5 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c
@@ -978,6 +978,8 @@ int amdgpu_driver_open_kms(struct drm_device *dev, struct 
drm_file *file_priv)
        struct amdgpu_fpriv *fpriv;
        int r, pasid;
 
+       if (!adev)
+               return -ENODEV;
        /* Ensure IB tests are run on ring */
        flush_delayed_work(&adev->delayed_init_work);
 
-- 
2.27.0.212.ge8ba1cc988-goog

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

Reply via email to