[PATCH 03/13] staging: unisys: visornic: no need to check debugfs return values

Greg Kroah-Hartman gregkh at linuxfoundation.org
Tue May 29 14:29:37 UTC 2018


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 visornic driver code by not caring about the value of
debugfs calls.  This ends up removing a number of lines of code that are
not needed.

Cc: David Kershner <david.kershner at unisys.com>
Cc: Tim Sell <timothy.sell at unisys.com>
Cc: David Binder <david.binder at unisys.com>
Cc: Sameer Wadgaonkar <sameer.wadgaonkar at unisys.com>
Cc: Charles Daniels <cdaniels at fastmail.com>
Cc: sparmaintainer at unisys.com
Signed-off-by: Greg Kroah-Hartman <gregkh at linuxfoundation.org>
---
 .../staging/unisys/visornic/visornic_main.c   | 23 +++++--------------
 1 file changed, 6 insertions(+), 17 deletions(-)

diff --git a/drivers/staging/unisys/visornic/visornic_main.c b/drivers/staging/unisys/visornic/visornic_main.c
index f734e835b382..3647b8f1ed28 100644
--- a/drivers/staging/unisys/visornic/visornic_main.c
+++ b/drivers/staging/unisys/visornic/visornic_main.c
@@ -2126,30 +2126,19 @@ static struct visor_driver visornic_driver = {
  */
 static int visornic_init(void)
 {
-	struct dentry *ret;
-	int err = -ENOMEM;
+	int err;
 
 	visornic_debugfs_dir = debugfs_create_dir("visornic", NULL);
-	if (!visornic_debugfs_dir)
-		return err;
 
-	ret = debugfs_create_file("info", 0400, visornic_debugfs_dir, NULL,
-				  &debugfs_info_fops);
-	if (!ret)
-		goto cleanup_debugfs;
-	ret = debugfs_create_file("enable_ints", 0200, visornic_debugfs_dir,
-				  NULL, &debugfs_enable_ints_fops);
-	if (!ret)
-		goto cleanup_debugfs;
+	debugfs_create_file("info", 0400, visornic_debugfs_dir, NULL,
+			    &debugfs_info_fops);
+	debugfs_create_file("enable_ints", 0200, visornic_debugfs_dir, NULL,
+			    &debugfs_enable_ints_fops);
 
 	err = visorbus_register_visor_driver(&visornic_driver);
 	if (err)
-		goto cleanup_debugfs;
+		debugfs_remove_recursive(visornic_debugfs_dir);
 
-	return 0;
-
-cleanup_debugfs:
-	debugfs_remove_recursive(visornic_debugfs_dir);
 	return err;
 }
 
-- 
2.17.0



More information about the devel mailing list