[PATCH 2/5] drm/i915: check dri root before debugfs init

Nirmoy Das nirmoy.das at amd.com
Fri Oct 8 09:17:01 UTC 2021


Return early if dri minor root dentry is NULL.

CC: Zhenyu Wang <zhenyuw at linux.intel.com>
CC: Zhi Wang <zhi.a.wang at intel.com>
CC: Jani Nikula <jani.nikula at linux.intel.com>
CC: Joonas Lahtinen <joonas.lahtinen at linux.intel.com>
CC: Rodrigo Vivi <rodrigo.vivi at intel.com>
CC: David Airlie <airlied at linux.ie>
CC: Daniel Vetter <daniel at ffwll.ch>
Signed-off-by: Nirmoy Das <nirmoy.das at amd.com>
---
 drivers/gpu/drm/i915/gvt/debugfs.c  | 3 +++
 drivers/gpu/drm/i915/i915_debugfs.c | 3 +++
 2 files changed, 6 insertions(+)

diff --git a/drivers/gpu/drm/i915/gvt/debugfs.c b/drivers/gpu/drm/i915/gvt/debugfs.c
index 9f1c209d9251..2d47acaa03ee 100644
--- a/drivers/gpu/drm/i915/gvt/debugfs.c
+++ b/drivers/gpu/drm/i915/gvt/debugfs.c
@@ -187,6 +187,9 @@ void intel_gvt_debugfs_init(struct intel_gvt *gvt)
 {
 	struct drm_minor *minor = gvt->gt->i915->drm.primary;

+	if (!minor->debugfs_root)
+		return;
+
 	gvt->debugfs_root = debugfs_create_dir("gvt", minor->debugfs_root);

 	debugfs_create_ulong("num_tracked_mmio", 0444, gvt->debugfs_root,
diff --git a/drivers/gpu/drm/i915/i915_debugfs.c b/drivers/gpu/drm/i915/i915_debugfs.c
index 44969f5dde50..d572b686edeb 100644
--- a/drivers/gpu/drm/i915/i915_debugfs.c
+++ b/drivers/gpu/drm/i915/i915_debugfs.c
@@ -1012,6 +1012,9 @@ void i915_debugfs_register(struct drm_i915_private *dev_priv)
 	struct drm_minor *minor = dev_priv->drm.primary;
 	int i;

+	if (!minor->debugfs_root)
+		return;
+
 	i915_debugfs_params(dev_priv);

 	debugfs_create_file("i915_forcewake_user", S_IRUSR, minor->debugfs_root,
--
2.32.0



More information about the dri-devel mailing list