From: "Christian König" <ckoenig.leichtzumerken@gmail.com>
To: ogabbay@kernel.org, dri-devel@lists.freedesktop.org
Subject: [PATCH 2/5] drm/debugfs: disallow debugfs access when device isn't registered
Date: Tue, 11 Jul 2023 16:04:15 +0200 [thread overview]
Message-ID: <20230711140418.3059-3-christian.koenig@amd.com> (raw)
In-Reply-To: <20230711140418.3059-1-christian.koenig@amd.com>
During device bringup it might be that we can't access the debugfs files.
Return -ENODEV until the registration is completed on access.
Signed-off-by: Christian König <christian.koenig@amd.com>
---
drivers/gpu/drm/drm_debugfs.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/drivers/gpu/drm/drm_debugfs.c b/drivers/gpu/drm/drm_debugfs.c
index 54376e2400bb..796cda62ad12 100644
--- a/drivers/gpu/drm/drm_debugfs.c
+++ b/drivers/gpu/drm/drm_debugfs.c
@@ -148,6 +148,9 @@ static int drm_debugfs_open(struct inode *inode, struct file *file)
{
struct drm_info_node *node = inode->i_private;
+ if (!device_is_registered(node->minor->kdev))
+ return -ENODEV;
+
return single_open(file, node->info_ent->show, node);
}
@@ -155,6 +158,10 @@ static int drm_debugfs_entry_open(struct inode *inode, struct file *file)
{
struct drm_debugfs_entry *entry = inode->i_private;
struct drm_debugfs_info *node = &entry->file;
+ struct drm_minor *minor = entry->dev->primary ?: entry->dev->accel;
+
+ if (!device_is_registered(minor->kdev))
+ return -ENODEV;
return single_open(file, node->show, entry);
}
--
2.34.1
next prev parent reply other threads:[~2023-07-11 14:04 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-07-11 14:04 DRM debugfs cleanup take 5 (resend) Christian König
2023-07-11 14:04 ` [PATCH 1/5] drm/debugfs: drop debugfs_init() for the render and accel node v2 Christian König
2023-07-11 14:04 ` Christian König [this message]
2023-07-11 14:04 ` [PATCH 3/5] drm/debugfs: rework debugfs directory creation v4 Christian König
2023-07-12 17:37 ` Tomer Tayar
2023-07-11 14:04 ` [PATCH 4/5] drm/debugfs: remove dev->debugfs_list and debugfs_mutex v2 Christian König
2023-07-11 14:04 ` [PATCH 5/5] drm/debugfs: rework drm_debugfs_create_files implementation Christian König
2023-07-12 17:38 ` Tomer Tayar
-- strict thread matches above, loose matches on Subject: below --
2023-08-29 11:01 DRM debugfs cleanup take 6 Christian König
2023-08-29 11:01 ` [PATCH 2/5] drm/debugfs: disallow debugfs access when device isn't registered Christian König
2023-08-29 11:31 ` Andi Shyti
2023-08-29 11:35 ` Christian König
2023-08-29 11:38 ` Andi Shyti
2023-08-29 12:31 ` Christian König
2023-08-30 7:57 ` Christian König
2023-08-30 8:48 ` Andi Shyti
2023-04-24 12:30 [PATCH 1/5] drm/debugfs: drop debugfs_init() for the render and accel node v2 Christian König
2023-04-24 12:30 ` [PATCH 2/5] drm/debugfs: disallow debugfs access when device isn't registered Christian König
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230711140418.3059-3-christian.koenig@amd.com \
--to=ckoenig.leichtzumerken@gmail.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=ogabbay@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.