x86: platform: no need to check return value of debugfs_create functions
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 22 Jan 2019 14:35:41 +0000 (15:35 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 3 Jun 2019 14:18:12 +0000 (16:18 +0200)
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: Ingo Molnar <mingo@redhat.com>
Cc: Borislav Petkov <bp@alien8.de>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Cc: <x86@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
arch/x86/platform/atom/punit_atom_debug.c
arch/x86/platform/intel-quark/imr.c
arch/x86/platform/intel/iosf_mbi.c
arch/x86/platform/uv/tlb_uv.c

index 6cb6076223bac8a1dc93d0f4179f24d97815056e..58f1023cf9bc07a24f3642783d8d16f7ba666bb4 100644 (file)
@@ -113,24 +113,12 @@ DEFINE_SHOW_ATTRIBUTE(punit_dev_state);
 
 static struct dentry *punit_dbg_file;
 
-static int punit_dbgfs_register(struct punit_device *punit_device)
+static void punit_dbgfs_register(struct punit_device *punit_device)
 {
-       struct dentry *dev_state;
-
        punit_dbg_file = debugfs_create_dir("punit_atom", NULL);
-       if (!punit_dbg_file)
-               return -ENXIO;
-
-       dev_state = debugfs_create_file("dev_power_state", 0444,
-                                       punit_dbg_file, punit_device,
-                                       &punit_dev_state_fops);
-       if (!dev_state) {
-               pr_err("punit_dev_state register failed\n");
-               debugfs_remove(punit_dbg_file);
-               return -ENXIO;
-       }
 
-       return 0;
+       debugfs_create_file("dev_power_state", 0444, punit_dbg_file,
+                           punit_device, &punit_dev_state_fops);
 }
 
 static void punit_dbgfs_unregister(void)
@@ -154,15 +142,12 @@ MODULE_DEVICE_TABLE(x86cpu, intel_punit_cpu_ids);
 static int __init punit_atom_debug_init(void)
 {
        const struct x86_cpu_id *id;
-       int ret;
 
        id = x86_match_cpu(intel_punit_cpu_ids);
        if (!id)
                return -ENODEV;
 
-       ret = punit_dbgfs_register((struct punit_device *)id->driver_data);
-       if (ret < 0)
-               return ret;
+       punit_dbgfs_register((struct punit_device *)id->driver_data);
 
        return 0;
 }
index b5420371d32d0714c3447f6ff376b50f7a1a0ac0..6dd25dc5f0279a420aa619662e82e7586ddb22b5 100644 (file)
@@ -35,7 +35,6 @@
 #include <linux/types.h>
 
 struct imr_device {
-       struct dentry   *file;
        bool            init;
        struct mutex    lock;
        int             max_imr;
@@ -231,13 +230,11 @@ DEFINE_SHOW_ATTRIBUTE(imr_dbgfs_state);
  * imr_debugfs_register - register debugfs hooks.
  *
  * @idev:      pointer to imr_device structure.
- * @return:    0 on success - errno on failure.
  */
-static int imr_debugfs_register(struct imr_device *idev)
+static void imr_debugfs_register(struct imr_device *idev)
 {
-       idev->file = debugfs_create_file("imr_state", 0444, NULL, idev,
-                                        &imr_dbgfs_state_fops);
-       return PTR_ERR_OR_ZERO(idev->file);
+       debugfs_create_file("imr_state", 0444, NULL, idev,
+                           &imr_dbgfs_state_fops);
 }
 
 /**
@@ -582,7 +579,6 @@ static const struct x86_cpu_id imr_ids[] __initconst = {
 static int __init imr_init(void)
 {
        struct imr_device *idev = &imr_dev;
-       int ret;
 
        if (!x86_match_cpu(imr_ids) || !iosf_mbi_available())
                return -ENODEV;
@@ -592,9 +588,7 @@ static int __init imr_init(void)
        idev->init = true;
 
        mutex_init(&idev->lock);
-       ret = imr_debugfs_register(idev);
-       if (ret != 0)
-               pr_warn("debugfs register failed!\n");
+       imr_debugfs_register(idev);
        imr_fixup_memmap(idev);
        return 0;
 }
index a9f2e888e13593eda7532fe5d1792ecc0865cb80..b18d4dec46583f32de508b123470e31fd472979a 100644 (file)
@@ -470,31 +470,16 @@ static struct dentry *iosf_dbg;
 
 static void iosf_sideband_debug_init(void)
 {
-       struct dentry *d;
-
        iosf_dbg = debugfs_create_dir("iosf_sb", NULL);
-       if (IS_ERR_OR_NULL(iosf_dbg))
-               return;
 
        /* mdr */
-       d = debugfs_create_x32("mdr", 0660, iosf_dbg, &dbg_mdr);
-       if (!d)
-               goto cleanup;
+       debugfs_create_x32("mdr", 0660, iosf_dbg, &dbg_mdr);
 
        /* mcrx */
-       d = debugfs_create_x32("mcrx", 0660, iosf_dbg, &dbg_mcrx);
-       if (!d)
-               goto cleanup;
+       debugfs_create_x32("mcrx", 0660, iosf_dbg, &dbg_mcrx);
 
        /* mcr - initiates mailbox tranaction */
-       d = debugfs_create_file("mcr", 0660, iosf_dbg, &dbg_mcr, &iosf_mcr_fops);
-       if (!d)
-               goto cleanup;
-
-       return;
-
-cleanup:
-       debugfs_remove_recursive(d);
+       debugfs_create_file("mcr", 0660, iosf_dbg, &dbg_mcr, &iosf_mcr_fops);
 }
 
 static void iosf_debugfs_init(void)
index 0c7dfec4acac8e55c6a418c5ea6b6269786b4a21..20c389a91b8033c1a8f134bff08dd7ada9a4d9bd 100644 (file)
@@ -66,7 +66,6 @@ static struct tunables tunables[] = {
 };
 
 static struct dentry *tunables_dir;
-static struct dentry *tunables_file;
 
 /* these correspond to the statistics printed by ptc_seq_show() */
 static char *stat_description[] = {
@@ -1700,18 +1699,8 @@ static int __init uv_ptc_init(void)
        }
 
        tunables_dir = debugfs_create_dir(UV_BAU_TUNABLES_DIR, NULL);
-       if (!tunables_dir) {
-               pr_err("unable to create debugfs directory %s\n",
-                      UV_BAU_TUNABLES_DIR);
-               return -EINVAL;
-       }
-       tunables_file = debugfs_create_file(UV_BAU_TUNABLES_FILE, 0600,
-                                       tunables_dir, NULL, &tunables_fops);
-       if (!tunables_file) {
-               pr_err("unable to create debugfs file %s\n",
-                      UV_BAU_TUNABLES_FILE);
-               return -EINVAL;
-       }
+       debugfs_create_file(UV_BAU_TUNABLES_FILE, 0600, tunables_dir, NULL,
+                           &tunables_fops);
        return 0;
 }