Commit 860286cf authored by Greg Kroah-Hartman's avatar Greg Kroah-Hartman Committed by Michael Ellerman
Browse files

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: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/20200209105901.1620958-1-gregkh@linuxfoundation.org
parent 88654d5b
Loading
Loading
Loading
Loading
+3 −7
Original line number Diff line number Diff line
@@ -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,

	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");

	if (fw_dump.dump_active) {
		rc = sysfs_create_file(fadump_kobj, &release_attr.attr);
+1 −2
Original line number Diff line number Diff line
@@ -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
+5 −20
Original line number Diff line number Diff line
@@ -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,
	for (i = 0; i < sizeof(ppc_emulated)/sizeof(*entries); i++)
		debugfs_create_u32(entries[i].name, 0644, dir,
				   (u32 *)&entries[i].val.counter);
		if (!d)
			goto fail;
	}

	return 0;

fail:
	debugfs_remove_recursive(dir);
	return -ENOMEM;
}

device_initcall(ppc_warn_emulated_init);