All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm/amdgpu: fix null pointer reference to adev.
@ 2020-07-07  3:26 Lepton Wu
  2020-07-07  6:59 ` Christian König
  0 siblings, 1 reply; 5+ messages in thread
From: Lepton Wu @ 2020-07-07  3:26 UTC (permalink / raw)
  To: amd-gfx; +Cc: alexander.deucher, christian.koenig, Lepton Wu

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.net@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

^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2020-07-07 18:36 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-07  3:26 [PATCH] drm/amdgpu: fix null pointer reference to adev Lepton Wu
2020-07-07  6:59 ` Christian König
2020-07-07 18:04   ` [PATCH v2] " Lepton Wu
2020-07-07 18:22     ` Alex Deucher
2020-07-07 18:26       ` lepton

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.