From 98161628da9ba5268f8adb15d239fad18aeb8647 Mon Sep 17 00:00:00 2001 From: Mr NeilBrown Date: Thu, 27 Feb 2020 16:17:41 +1100 Subject: [PATCH] LU-6142 lustre: no need to check debugfs return values 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 Signed-off-by: Mr NeilBrown Change-Id: I78bddd60a8ae26418e1b4f99938b21cd652aea08 Reviewed-on: https://review.whamcloud.com/37748 Tested-by: jenkins Tested-by: Maloo Reviewed-by: Andreas Dilger Reviewed-by: Shaun Tancheff Reviewed-by: James Simmons Reviewed-by: Oleg Drokin --- lustre/llite/lproc_llite.c | 10 ++++------ lustre/obdclass/genops.c | 5 ----- lustre/obdclass/lprocfs_status_server.c | 5 ----- lustre/obdclass/obd_sysfs.c | 19 ------------------- 4 files changed, 4 insertions(+), 35 deletions(-) diff --git a/lustre/llite/lproc_llite.c b/lustre/llite/lproc_llite.c index 3b7936e..3bb3de6 100644 --- a/lustre/llite/lproc_llite.c +++ b/lustre/llite/lproc_llite.c @@ -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; } diff --git a/lustre/obdclass/genops.c b/lustre/obdclass/genops.c index a02b756..75388ed 100644 --- a/lustre/obdclass/genops.c +++ b/lustre/obdclass/genops.c @@ -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; diff --git a/lustre/obdclass/lprocfs_status_server.c b/lustre/obdclass/lprocfs_status_server.c index 03edc1d..27f950e 100644 --- a/lustre/obdclass/lprocfs_status_server.c +++ b/lustre/obdclass/lprocfs_status_server.c @@ -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: diff --git a/lustre/obdclass/obd_sysfs.c b/lustre/obdclass/obd_sysfs.c index d79bb63..6493ad9 100644 --- a/lustre/obdclass/obd_sysfs.c +++ b/lustre/obdclass/obd_sysfs.c @@ -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)) { -- 1.8.3.1