mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-08-30 22:54:17 -04:00
debugfs: warn if file creation failed due to uninitialized debugfs
Improve debugfs_start_creating() to warn if it was used before debugfs initialization. It silently returned ERR_PTR(-ENOENT) before, but it is hard to find the cause of failure especially if it was called by debugfs_create_dir(), because the document of the function says: > NOTE: it's expected that most callers should _ignore_ the errors returned > by this function. Other debugfs functions handle the fact that the "dentry" > passed to them could be an error and they don't crash in that case. > Drivers should generally work fine even if debugfs fails to init anyway. Signed-off-by: Yohei Kojima <yk@y-koj.net> Link: https://patch.msgid.link/6d1dc775f7d5e754d734907514534054f682bac5.1781171918.git.yk@y-koj.net Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
committed by
Danilo Krummrich
parent
06553566a8
commit
c3a280ff72
@@ -368,8 +368,11 @@ static struct dentry *debugfs_start_creating(const char *name,
|
||||
if (!debugfs_enabled)
|
||||
return ERR_PTR(-EPERM);
|
||||
|
||||
if (!debugfs_initialized())
|
||||
if (!debugfs_initialized()) {
|
||||
pr_err("Unable to create file '%s', debugfs is not initialized yet\n",
|
||||
name);
|
||||
return ERR_PTR(-ENOENT);
|
||||
}
|
||||
|
||||
pr_debug("creating file '%s'\n", name);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user