Commit 7a0f2178 authored by Christian König's avatar Christian König Committed by Christian König

drm/debugfs: disallow debugfs access when device isn't registered

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: default avatarChristian König <christian.koenig@amd.com>
Reviewed-by: default avatarAndi Shyti <andi.shyti@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20230829110115.3442-3-christian.koenig@amd.com
parent e76e7ec8
......@@ -150,6 +150,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);
}
......@@ -157,6 +160,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);
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment