mirror of
https://github.com/torvalds/linux.git
synced 2024-12-19 01:23:20 +00:00
powerpc/kernel: 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. Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au> Link: https://lore.kernel.org/r/20200209105901.1620958-1-gregkh@linuxfoundation.org
This commit is contained in:
parent
88654d5b44
commit
860286cf33
@ -1455,7 +1455,6 @@ DEFINE_SHOW_ATTRIBUTE(fadump_region);
|
||||
|
||||
static void fadump_init_files(void)
|
||||
{
|
||||
struct dentry *debugfs_file;
|
||||
int rc = 0;
|
||||
|
||||
fadump_kobj = kobject_create_and_add("fadump", kernel_kobj);
|
||||
@ -1463,12 +1462,9 @@ static void fadump_init_files(void)
|
||||
pr_err("failed to create fadump kobject\n");
|
||||
return;
|
||||
}
|
||||
debugfs_file = debugfs_create_file("fadump_region", 0444,
|
||||
powerpc_debugfs_root, NULL,
|
||||
&fadump_region_fops);
|
||||
if (!debugfs_file)
|
||||
printk(KERN_ERR "fadump: unable to create debugfs file"
|
||||
" fadump_region\n");
|
||||
|
||||
debugfs_create_file("fadump_region", 0444, powerpc_debugfs_root, NULL,
|
||||
&fadump_region_fops);
|
||||
|
||||
if (fw_dump.dump_active) {
|
||||
rc = sysfs_create_file(fadump_kobj, &release_attr.attr);
|
||||
|
@ -787,8 +787,7 @@ EXPORT_SYMBOL(powerpc_debugfs_root);
|
||||
static int powerpc_debugfs_init(void)
|
||||
{
|
||||
powerpc_debugfs_root = debugfs_create_dir("powerpc", NULL);
|
||||
|
||||
return powerpc_debugfs_root == NULL;
|
||||
return 0;
|
||||
}
|
||||
arch_initcall(powerpc_debugfs_init);
|
||||
#endif
|
||||
|
@ -2278,35 +2278,20 @@ void ppc_warn_emulated_print(const char *type)
|
||||
|
||||
static int __init ppc_warn_emulated_init(void)
|
||||
{
|
||||
struct dentry *dir, *d;
|
||||
struct dentry *dir;
|
||||
unsigned int i;
|
||||
struct ppc_emulated_entry *entries = (void *)&ppc_emulated;
|
||||
|
||||
if (!powerpc_debugfs_root)
|
||||
return -ENODEV;
|
||||
|
||||
dir = debugfs_create_dir("emulated_instructions",
|
||||
powerpc_debugfs_root);
|
||||
if (!dir)
|
||||
return -ENOMEM;
|
||||
|
||||
d = debugfs_create_u32("do_warn", 0644, dir,
|
||||
&ppc_warn_emulated);
|
||||
if (!d)
|
||||
goto fail;
|
||||
debugfs_create_u32("do_warn", 0644, dir, &ppc_warn_emulated);
|
||||
|
||||
for (i = 0; i < sizeof(ppc_emulated)/sizeof(*entries); i++) {
|
||||
d = debugfs_create_u32(entries[i].name, 0644, dir,
|
||||
(u32 *)&entries[i].val.counter);
|
||||
if (!d)
|
||||
goto fail;
|
||||
}
|
||||
for (i = 0; i < sizeof(ppc_emulated)/sizeof(*entries); i++)
|
||||
debugfs_create_u32(entries[i].name, 0644, dir,
|
||||
(u32 *)&entries[i].val.counter);
|
||||
|
||||
return 0;
|
||||
|
||||
fail:
|
||||
debugfs_remove_recursive(dir);
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
device_initcall(ppc_warn_emulated_init);
|
||||
|
Loading…
Reference in New Issue
Block a user