Whamcloud - gitweb
LU-6142 lustre: no need to check debugfs return values 48/37748/4
authorMr NeilBrown <neilb@suse.de>
Thu, 27 Feb 2020 05:17:41 +0000 (16:17 +1100)
committerOleg Drokin <green@whamcloud.com>
Tue, 14 Apr 2020 08:09:38 +0000 (08:09 +0000)
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.

Clean up the lustre core code by not caring about the value of debugfs
calls.  This ends up removing a number of lines of code that are not
needed.

Test-Parameters: trivial
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Mr NeilBrown <neilb@suse.de>
Change-Id: I78bddd60a8ae26418e1b4f99938b21cd652aea08
Reviewed-on: https://review.whamcloud.com/37748
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: Shaun Tancheff <shaun.tancheff@hpe.com>
Reviewed-by: James Simmons <jsimmons@infradead.org>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
lustre/llite/lproc_llite.c
lustre/obdclass/genops.c
lustre/obdclass/lprocfs_status_server.c
lustre/obdclass/obd_sysfs.c

index 3b7936e..3bb3de6 100644 (file)
@@ -75,13 +75,11 @@ int llite_tunables_register(void)
                goto free_kobj;
 
        llite_root = debugfs_create_dir("llite", debugfs_lustre_root);
-       if (IS_ERR_OR_NULL(llite_root)) {
-               rc = llite_root ? PTR_ERR(llite_root) : -ENOMEM;
-               llite_root = NULL;
+       return 0;
+
 free_kobj:
-               kobject_put(llite_kobj);
-               llite_kobj = NULL;
-       }
+       kobject_put(llite_kobj);
+       llite_kobj = NULL;
 
        return rc;
 }
index a02b756..75388ed 100644 (file)
@@ -204,11 +204,6 @@ struct obd_type *class_add_symlinks(const char *name, bool enable_proc)
                return ERR_PTR(rc);
 
        symlink = debugfs_create_dir(name, debugfs_lustre_root);
-       if (IS_ERR_OR_NULL(symlink)) {
-               rc = symlink ? PTR_ERR(symlink) : -ENOMEM;
-               kobject_put(&type->typ_kobj);
-               return ERR_PTR(rc);
-       }
        type->typ_debugfs_entry = symlink;
        type->typ_sym_filter = true;
 
index 03edc1d..27f950e 100644 (file)
@@ -72,11 +72,6 @@ struct dentry *ldebugfs_add_symlink(const char *name, const char *target,
        va_end(ap);
 
        entry = debugfs_create_symlink(name, parent, dest);
-       if (IS_ERR_OR_NULL(entry)) {
-               CERROR("LdebugFS: Could not create symbolic link from %s to %s\n",
-                      name, dest);
-               entry = NULL;
-       }
 
        OBD_FREE(dest, MAX_STRING_SIZE + 1);
 no_entry:
index d79bb63..6493ad9 100644 (file)
@@ -586,31 +586,12 @@ int class_procfs_init(void)
        }
 
        debugfs_lustre_root = debugfs_create_dir("lustre", NULL);
-       if (IS_ERR_OR_NULL(debugfs_lustre_root)) {
-               rc = debugfs_lustre_root ? PTR_ERR(debugfs_lustre_root)
-                                        : -ENOMEM;
-               debugfs_lustre_root = NULL;
-               kset_unregister(lustre_kset);
-               goto out;
-       }
 
        file = debugfs_create_file("devices", 0444, debugfs_lustre_root, NULL,
                                   &obd_device_list_fops);
-       if (IS_ERR_OR_NULL(file)) {
-               rc = file ? PTR_ERR(file) : -ENOMEM;
-               debugfs_remove(debugfs_lustre_root);
-               kset_unregister(lustre_kset);
-               goto out;
-       }
 
        file = debugfs_create_file("health_check", 0444, debugfs_lustre_root,
                                   NULL, &health_check_fops);
-       if (IS_ERR_OR_NULL(file)) {
-               rc = file ? PTR_ERR(file) : -ENOMEM;
-               debugfs_remove_recursive(debugfs_lustre_root);
-               kset_unregister(lustre_kset);
-               goto out;
-       }
 
        entry = lprocfs_register("fs/lustre", NULL, NULL, NULL);
        if (IS_ERR(entry)) {