[Intel-gfx] [PATCH 5/5] drm/tegra: check root dentry before debugfs init

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


Return early if crtc or connector's debugfs root dentries are NULL.

CC: Thierry Reding <thierry.reding at gmail.com>
CC: David Airlie <airlied at linux.ie>
CC: Daniel Vetter <daniel at ffwll.ch>
CC: Jonathan Hunter <jonathanh at nvidia.com>

Signed-off-by: Nirmoy Das <nirmoy.das at amd.com>
---
 drivers/gpu/drm/tegra/dc.c   | 5 +++++
 drivers/gpu/drm/tegra/dsi.c  | 4 ++++
 drivers/gpu/drm/tegra/hdmi.c | 5 +++++
 drivers/gpu/drm/tegra/sor.c  | 4 ++++
 4 files changed, 18 insertions(+)

diff --git a/drivers/gpu/drm/tegra/dc.c b/drivers/gpu/drm/tegra/dc.c
index 16c7aabb94d3..87eeda68d231 100644
--- a/drivers/gpu/drm/tegra/dc.c
+++ b/drivers/gpu/drm/tegra/dc.c
@@ -1623,6 +1623,11 @@ static int tegra_dc_late_register(struct drm_crtc *crtc)
 	struct dentry *root;
 	struct tegra_dc *dc = to_tegra_dc(crtc);

+	if (!crtc->debugfs_entry) {
+		dc->debugfs_files = NULL;
+		return 0;
+	}
+
 #ifdef CONFIG_DEBUG_FS
 	root = crtc->debugfs_entry;
 #else
diff --git a/drivers/gpu/drm/tegra/dsi.c b/drivers/gpu/drm/tegra/dsi.c
index f46d377f0c30..f0263165e261 100644
--- a/drivers/gpu/drm/tegra/dsi.c
+++ b/drivers/gpu/drm/tegra/dsi.c
@@ -236,6 +236,10 @@ static int tegra_dsi_late_register(struct drm_connector *connector)
 	struct dentry *root = connector->debugfs_entry;
 	struct tegra_dsi *dsi = to_dsi(output);

+	if (!root) {
+		dsi->debugfs_files = NULL;
+		return 0;
+	}
 	dsi->debugfs_files = kmemdup(debugfs_files, sizeof(debugfs_files),
 				     GFP_KERNEL);
 	if (!dsi->debugfs_files)
diff --git a/drivers/gpu/drm/tegra/hdmi.c b/drivers/gpu/drm/tegra/hdmi.c
index e5d2a4026028..400319db0afc 100644
--- a/drivers/gpu/drm/tegra/hdmi.c
+++ b/drivers/gpu/drm/tegra/hdmi.c
@@ -1065,6 +1065,11 @@ static int tegra_hdmi_late_register(struct drm_connector *connector)
 	struct dentry *root = connector->debugfs_entry;
 	struct tegra_hdmi *hdmi = to_hdmi(output);

+	if (!root) {
+		hdmi->debugfs_files = NULL;
+		return 0;
+	}
+
 	hdmi->debugfs_files = kmemdup(debugfs_files, sizeof(debugfs_files),
 				      GFP_KERNEL);
 	if (!hdmi->debugfs_files)
diff --git a/drivers/gpu/drm/tegra/sor.c b/drivers/gpu/drm/tegra/sor.c
index 0ea320c1092b..a8a3b0a587d9 100644
--- a/drivers/gpu/drm/tegra/sor.c
+++ b/drivers/gpu/drm/tegra/sor.c
@@ -1687,6 +1687,10 @@ static int tegra_sor_late_register(struct drm_connector *connector)
 	struct dentry *root = connector->debugfs_entry;
 	struct tegra_sor *sor = to_sor(output);

+	if (!root) {
+		sor->debugfs_files = NULL;
+		return 0;
+	}
 	sor->debugfs_files = kmemdup(debugfs_files, sizeof(debugfs_files),
 				     GFP_KERNEL);
 	if (!sor->debugfs_files)
--
2.32.0



More information about the Intel-gfx mailing list