powerpc: pseries: no need to check return value of debugfs_create functions
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 14 Oct 2019 10:16:42 +0000 (12:16 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 2 Nov 2019 17:09:10 +0000 (18:09 +0100)
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: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Michael Ellerman <mpe@ellerman.id.au>
Cc: "Naveen N. Rao" <naveen.n.rao@linux.vnet.ibm.com>
Cc: linuxppc-dev@lists.ozlabs.org
Cc: linux-kernel@vger.kernel.org
Link: https://lore.kernel.org/r/20191014101642.GA30179@kroah.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
arch/powerpc/platforms/pseries/dtl.c
arch/powerpc/platforms/pseries/hvCall_inst.c
arch/powerpc/platforms/pseries/lpar.c

index 2b87480f2837ae3241cd2acacd50f31ce5461bcb..eab8aa293743b421fba23cb266a2843d7e489033 100644 (file)
@@ -19,7 +19,6 @@
 
 struct dtl {
        struct dtl_entry        *buf;
-       struct dentry           *file;
        int                     cpu;
        int                     buf_entries;
        u64                     last_idx;
@@ -320,46 +319,28 @@ static const struct file_operations dtl_fops = {
 
 static struct dentry *dtl_dir;
 
-static int dtl_setup_file(struct dtl *dtl)
+static void dtl_setup_file(struct dtl *dtl)
 {
        char name[10];
 
        sprintf(name, "cpu-%d", dtl->cpu);
 
-       dtl->file = debugfs_create_file(name, 0400, dtl_dir, dtl, &dtl_fops);
-       if (!dtl->file)
-               return -ENOMEM;
-
-       return 0;
+       debugfs_create_file(name, 0400, dtl_dir, dtl, &dtl_fops);
 }
 
 static int dtl_init(void)
 {
-       struct dentry *event_mask_file, *buf_entries_file;
-       int rc, i;
+       int i;
 
        if (!firmware_has_feature(FW_FEATURE_SPLPAR))
                return -ENODEV;
 
        /* set up common debugfs structure */
 
-       rc = -ENOMEM;
        dtl_dir = debugfs_create_dir("dtl", powerpc_debugfs_root);
-       if (!dtl_dir) {
-               printk(KERN_WARNING "%s: can't create dtl root dir\n",
-                               __func__);
-               goto err;
-       }
 
-       event_mask_file = debugfs_create_x8("dtl_event_mask", 0600,
-                               dtl_dir, &dtl_event_mask);
-       buf_entries_file = debugfs_create_u32("dtl_buf_entries", 0400,
-                               dtl_dir, &dtl_buf_entries);
-
-       if (!event_mask_file || !buf_entries_file) {
-               printk(KERN_WARNING "%s: can't create dtl files\n", __func__);
-               goto err_remove_dir;
-       }
+       debugfs_create_x8("dtl_event_mask", 0600, dtl_dir, &dtl_event_mask);
+       debugfs_create_u32("dtl_buf_entries", 0400, dtl_dir, &dtl_buf_entries);
 
        /* set up the per-cpu log structures */
        for_each_possible_cpu(i) {
@@ -367,16 +348,9 @@ static int dtl_init(void)
                spin_lock_init(&dtl->lock);
                dtl->cpu = i;
 
-               rc = dtl_setup_file(dtl);
-               if (rc)
-                       goto err_remove_dir;
+               dtl_setup_file(dtl);
        }
 
        return 0;
-
-err_remove_dir:
-       debugfs_remove_recursive(dtl_dir);
-err:
-       return rc;
 }
 machine_arch_initcall(pseries, dtl_init);
index bcc1b67417a84b066d65ac9e37a851acf893e10d..c40c62ec432e277f4cfebcf979ce2d4fc9881ac4 100644 (file)
@@ -129,7 +129,6 @@ static void probe_hcall_exit(void *ignored, unsigned long opcode, long retval,
 static int __init hcall_inst_init(void)
 {
        struct dentry *hcall_root;
-       struct dentry *hcall_file;
        char cpu_name_buf[CPU_NAME_BUF_SIZE];
        int cpu;
 
@@ -145,17 +144,12 @@ static int __init hcall_inst_init(void)
        }
 
        hcall_root = debugfs_create_dir(HCALL_ROOT_DIR, NULL);
-       if (!hcall_root)
-               return -ENOMEM;
 
        for_each_possible_cpu(cpu) {
                snprintf(cpu_name_buf, CPU_NAME_BUF_SIZE, "cpu%d", cpu);
-               hcall_file = debugfs_create_file(cpu_name_buf, 0444,
-                                                hcall_root,
-                                                per_cpu(hcall_stats, cpu),
-                                                &hcall_inst_seq_fops);
-               if (!hcall_file)
-                       return -ENOMEM;
+               debugfs_create_file(cpu_name_buf, 0444, hcall_root,
+                                   per_cpu(hcall_stats, cpu),
+                                   &hcall_inst_seq_fops);
        }
 
        return 0;
index f87a5c64e24dcf534de83255baf8d7bbd441433f..f9f57c55655ecf1f12d8f9f6d46953ce7d365d6b 100644 (file)
@@ -1998,24 +1998,11 @@ static int __init vpa_debugfs_init(void)
                return 0;
 
        vpa_dir = debugfs_create_dir("vpa", powerpc_debugfs_root);
-       if (!vpa_dir) {
-               pr_warn("%s: can't create vpa root dir\n", __func__);
-               return -ENOMEM;
-       }
 
        /* set up the per-cpu vpa file*/
        for_each_possible_cpu(i) {
-               struct dentry *d;
-
                sprintf(name, "cpu-%ld", i);
-
-               d = debugfs_create_file(name, 0400, vpa_dir, (void *)i,
-                                       &vpa_fops);
-               if (!d) {
-                       pr_warn("%s: can't create per-cpu vpa file\n",
-                                       __func__);
-                       return -ENOMEM;
-               }
+               debugfs_create_file(name, 0400, vpa_dir, (void *)i, &vpa_fops);
        }
 
        return 0;