提交 ef6687c6 编写于 作者: L Luis de Bethencourt 提交者: Greg Kroah-Hartman

staging: wilc1000: fix error handling in wilc_debugfs_init()

We can just ignore the return value from debugfs_create_dir() and
debugfs_create_file(). The second one already interanlly checks the dentry
created by the first before creating the file.

debugfs was written so it would be easy to use, no need for error checking.
Signed-off-by: NLuis de Bethencourt <luisbg@osg.samsung.com>
Suggested-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
上级 eeeb5fb9
...@@ -102,35 +102,16 @@ static struct wilc_debugfs_info_t debugfs_info[] = { ...@@ -102,35 +102,16 @@ static struct wilc_debugfs_info_t debugfs_info[] = {
static int __init wilc_debugfs_init(void) static int __init wilc_debugfs_init(void)
{ {
int i; int i;
struct dentry *debugfs_files;
struct wilc_debugfs_info_t *info; struct wilc_debugfs_info_t *info;
wilc_dir = debugfs_create_dir("wilc_wifi", NULL); wilc_dir = debugfs_create_dir("wilc_wifi", NULL);
if (wilc_dir == ERR_PTR(-ENODEV)) {
/* it's not error. the debugfs is just not being enabled. */
printk("ERR, kernel has built without debugfs support\n");
return 0;
}
if (!wilc_dir) {
printk("ERR, debugfs create dir\n");
return -1;
}
for (i = 0; i < ARRAY_SIZE(debugfs_info); i++) { for (i = 0; i < ARRAY_SIZE(debugfs_info); i++) {
info = &debugfs_info[i]; info = &debugfs_info[i];
debugfs_files = debugfs_create_file(info->name, debugfs_create_file(info->name,
info->perm, info->perm,
wilc_dir, wilc_dir,
&info->data, &info->data,
&info->fops); &info->fops);
if (!debugfs_files) {
printk("ERR fail to create the debugfs file, %s\n", info->name);
debugfs_remove_recursive(wilc_dir);
return -1;
}
} }
return 0; return 0;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册