mirror of
https://github.com/torvalds/linux
synced 2024-11-05 18:23:50 +00:00
lib: notifier-error-inject: no need to check return value of debugfs_create functions
When calling debugfs functions, there is no need to ever check the return value. The function can work or not, but the code logic should never do something different based on this. Cc: Thomas Gleixner <tglx@linutronix.de> Cc: linux-kernel@vger.kernel.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Link: https://lore.kernel.org/r/20190612153613.GA21239@kroah.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
1be51474f9
commit
56f3364aba
1 changed files with 1 additions and 12 deletions
|
@ -59,33 +59,22 @@ struct dentry *notifier_err_inject_init(const char *name, struct dentry *parent,
|
||||||
err_inject->nb.priority = priority;
|
err_inject->nb.priority = priority;
|
||||||
|
|
||||||
dir = debugfs_create_dir(name, parent);
|
dir = debugfs_create_dir(name, parent);
|
||||||
if (!dir)
|
|
||||||
return ERR_PTR(-ENOMEM);
|
|
||||||
|
|
||||||
actions_dir = debugfs_create_dir("actions", dir);
|
actions_dir = debugfs_create_dir("actions", dir);
|
||||||
if (!actions_dir)
|
|
||||||
goto fail;
|
|
||||||
|
|
||||||
for (action = err_inject->actions; action->name; action++) {
|
for (action = err_inject->actions; action->name; action++) {
|
||||||
struct dentry *action_dir;
|
struct dentry *action_dir;
|
||||||
|
|
||||||
action_dir = debugfs_create_dir(action->name, actions_dir);
|
action_dir = debugfs_create_dir(action->name, actions_dir);
|
||||||
if (!action_dir)
|
|
||||||
goto fail;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Create debugfs r/w file containing action->error. If
|
* Create debugfs r/w file containing action->error. If
|
||||||
* notifier call chain is called with action->val, it will
|
* notifier call chain is called with action->val, it will
|
||||||
* fail with the error code
|
* fail with the error code
|
||||||
*/
|
*/
|
||||||
if (!debugfs_create_errno("error", mode, action_dir,
|
debugfs_create_errno("error", mode, action_dir, &action->error);
|
||||||
&action->error))
|
|
||||||
goto fail;
|
|
||||||
}
|
}
|
||||||
return dir;
|
return dir;
|
||||||
fail:
|
|
||||||
debugfs_remove_recursive(dir);
|
|
||||||
return ERR_PTR(-ENOMEM);
|
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL_GPL(notifier_err_inject_init);
|
EXPORT_SYMBOL_GPL(notifier_err_inject_init);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue