All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/3] staging: lustre: llite: Remove else after goto
@ 2017-12-06 19:16 ` Luis de Bethencourt
  0 siblings, 0 replies; 6+ messages in thread
From: Luis de Bethencourt @ 2017-12-06 19:16 UTC (permalink / raw)
  To: linux-kernel
  Cc: devel, lustre-devel, Lai Siyao, Ernestas Kulik, Aastha Gupta,
	Greg Kroah-Hartman, James Simmons, Andreas Dilger, Oleg Drokin,
	Luis de Bethencourt

If an "if" branch is terminated by a "goto", there's no need to have an
"else" statement and an indented block of code.

Remove the "else" statement to simplify the code flow.

Signed-off-by: Luis de Bethencourt <luisbg@kernel.org>
---

Hi,

The following patches remove unneeded 'else' after a 'goto' or 'return'.
They are meant to just make the code more readable and aren't functional
changes.

Thanks,
Luis

 drivers/staging/lustre/lustre/llite/dir.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/lustre/lustre/llite/dir.c b/drivers/staging/lustre/lustre/llite/dir.c
index 5b2e47c246f3..f5b67a4923e3 100644
--- a/drivers/staging/lustre/lustre/llite/dir.c
+++ b/drivers/staging/lustre/lustre/llite/dir.c
@@ -1339,9 +1339,9 @@ static long ll_dir_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
 					       cmd == LL_IOC_MDC_GETINFO)) {
 				rc = 0;
 				goto skip_lmm;
-			} else {
-				goto out_req;
 			}
+
+			goto out_req;
 		}
 
 		if (cmd == IOC_MDC_GETFILESTRIPE ||
-- 
2.15.1

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [lustre-devel] [PATCH 1/3] staging: lustre: llite: Remove else after goto
@ 2017-12-06 19:16 ` Luis de Bethencourt
  0 siblings, 0 replies; 6+ messages in thread
From: Luis de Bethencourt @ 2017-12-06 19:16 UTC (permalink / raw)
  To: linux-kernel
  Cc: devel, lustre-devel, Lai Siyao, Ernestas Kulik, Aastha Gupta,
	Greg Kroah-Hartman, James Simmons, Andreas Dilger, Oleg Drokin,
	Luis de Bethencourt

If an "if" branch is terminated by a "goto", there's no need to have an
"else" statement and an indented block of code.

Remove the "else" statement to simplify the code flow.

Signed-off-by: Luis de Bethencourt <luisbg@kernel.org>
---

Hi,

The following patches remove unneeded 'else' after a 'goto' or 'return'.
They are meant to just make the code more readable and aren't functional
changes.

Thanks,
Luis

 drivers/staging/lustre/lustre/llite/dir.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/lustre/lustre/llite/dir.c b/drivers/staging/lustre/lustre/llite/dir.c
index 5b2e47c246f3..f5b67a4923e3 100644
--- a/drivers/staging/lustre/lustre/llite/dir.c
+++ b/drivers/staging/lustre/lustre/llite/dir.c
@@ -1339,9 +1339,9 @@ static long ll_dir_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
 					       cmd == LL_IOC_MDC_GETINFO)) {
 				rc = 0;
 				goto skip_lmm;
-			} else {
-				goto out_req;
 			}
+
+			goto out_req;
 		}
 
 		if (cmd == IOC_MDC_GETFILESTRIPE ||
-- 
2.15.1

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 2/3] staging: lustre: llite: Remove redundant else keyword
  2017-12-06 19:16 ` [lustre-devel] " Luis de Bethencourt
@ 2017-12-06 19:16   ` Luis de Bethencourt
  -1 siblings, 0 replies; 6+ messages in thread
From: Luis de Bethencourt @ 2017-12-06 19:16 UTC (permalink / raw)
  To: linux-kernel
  Cc: devel, lustre-devel, Lai Siyao, Ernestas Kulik, Aastha Gupta,
	Greg Kroah-Hartman, James Simmons, Andreas Dilger, Oleg Drokin,
	Luis de Bethencourt

There is no need to use 'else' if in main branch 'goto' is present.

Signed-off-by: Luis de Bethencourt <luisbg@kernel.org>
---
 drivers/staging/lustre/lustre/llite/llite_lib.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/staging/lustre/lustre/llite/llite_lib.c b/drivers/staging/lustre/lustre/llite/llite_lib.c
index 8666f1e81ade..e84719662edf 100644
--- a/drivers/staging/lustre/lustre/llite/llite_lib.c
+++ b/drivers/staging/lustre/lustre/llite/llite_lib.c
@@ -236,7 +236,9 @@ static int client_common_fill_super(struct super_block *sb, char *md, char *dt,
 				   "An MDT (md %s) is performing recovery, of which this client is not a part. Please wait for recovery to complete, abort, or time out.\n",
 				   md);
 		goto out;
-	} else if (err) {
+	}
+
+	if (err) {
 		CERROR("cannot connect to %s: rc = %d\n", md, err);
 		goto out;
 	}
-- 
2.15.1

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [lustre-devel] [PATCH 2/3] staging: lustre: llite: Remove redundant else keyword
@ 2017-12-06 19:16   ` Luis de Bethencourt
  0 siblings, 0 replies; 6+ messages in thread
From: Luis de Bethencourt @ 2017-12-06 19:16 UTC (permalink / raw)
  To: linux-kernel
  Cc: devel, lustre-devel, Lai Siyao, Ernestas Kulik, Aastha Gupta,
	Greg Kroah-Hartman, James Simmons, Andreas Dilger, Oleg Drokin,
	Luis de Bethencourt

There is no need to use 'else' if in main branch 'goto' is present.

Signed-off-by: Luis de Bethencourt <luisbg@kernel.org>
---
 drivers/staging/lustre/lustre/llite/llite_lib.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/staging/lustre/lustre/llite/llite_lib.c b/drivers/staging/lustre/lustre/llite/llite_lib.c
index 8666f1e81ade..e84719662edf 100644
--- a/drivers/staging/lustre/lustre/llite/llite_lib.c
+++ b/drivers/staging/lustre/lustre/llite/llite_lib.c
@@ -236,7 +236,9 @@ static int client_common_fill_super(struct super_block *sb, char *md, char *dt,
 				   "An MDT (md %s) is performing recovery, of which this client is not a part. Please wait for recovery to complete, abort, or time out.\n",
 				   md);
 		goto out;
-	} else if (err) {
+	}
+
+	if (err) {
 		CERROR("cannot connect to %s: rc = %d\n", md, err);
 		goto out;
 	}
-- 
2.15.1

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 3/3] staging: lustre: llite: Remove redundant else keyword
  2017-12-06 19:16 ` [lustre-devel] " Luis de Bethencourt
@ 2017-12-06 19:17   ` Luis de Bethencourt
  -1 siblings, 0 replies; 6+ messages in thread
From: Luis de Bethencourt @ 2017-12-06 19:17 UTC (permalink / raw)
  To: linux-kernel
  Cc: devel, lustre-devel, Lai Siyao, Ernestas Kulik, Aastha Gupta,
	Greg Kroah-Hartman, James Simmons, Andreas Dilger, Oleg Drokin,
	Luis de Bethencourt

There is no need to use 'else' if in main branch 'return' is present.

Signed-off-by: Luis de Bethencourt <luisbg@kernel.org>
---
 drivers/staging/lustre/lustre/llite/vvp_io.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/lustre/lustre/llite/vvp_io.c b/drivers/staging/lustre/lustre/llite/vvp_io.c
index bfae98e82d6f..e7a4778e02e4 100644
--- a/drivers/staging/lustre/lustre/llite/vvp_io.c
+++ b/drivers/staging/lustre/lustre/llite/vvp_io.c
@@ -699,7 +699,7 @@ static int vvp_io_read_start(const struct lu_env *env,
 	result = vvp_prep_size(env, obj, io, pos, tot, &exceed);
 	if (result != 0)
 		return result;
-	else if (exceed != 0)
+	if (exceed != 0)
 		goto out;
 
 	LU_OBJECT_HEADER(D_INODE, env, &obj->co_lu,
-- 
2.15.1

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [lustre-devel] [PATCH 3/3] staging: lustre: llite: Remove redundant else keyword
@ 2017-12-06 19:17   ` Luis de Bethencourt
  0 siblings, 0 replies; 6+ messages in thread
From: Luis de Bethencourt @ 2017-12-06 19:17 UTC (permalink / raw)
  To: linux-kernel
  Cc: devel, lustre-devel, Lai Siyao, Ernestas Kulik, Aastha Gupta,
	Greg Kroah-Hartman, James Simmons, Andreas Dilger, Oleg Drokin,
	Luis de Bethencourt

There is no need to use 'else' if in main branch 'return' is present.

Signed-off-by: Luis de Bethencourt <luisbg@kernel.org>
---
 drivers/staging/lustre/lustre/llite/vvp_io.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/lustre/lustre/llite/vvp_io.c b/drivers/staging/lustre/lustre/llite/vvp_io.c
index bfae98e82d6f..e7a4778e02e4 100644
--- a/drivers/staging/lustre/lustre/llite/vvp_io.c
+++ b/drivers/staging/lustre/lustre/llite/vvp_io.c
@@ -699,7 +699,7 @@ static int vvp_io_read_start(const struct lu_env *env,
 	result = vvp_prep_size(env, obj, io, pos, tot, &exceed);
 	if (result != 0)
 		return result;
-	else if (exceed != 0)
+	if (exceed != 0)
 		goto out;
 
 	LU_OBJECT_HEADER(D_INODE, env, &obj->co_lu,
-- 
2.15.1

^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2017-12-06 19:17 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-12-06 19:16 [PATCH 1/3] staging: lustre: llite: Remove else after goto Luis de Bethencourt
2017-12-06 19:16 ` [lustre-devel] " Luis de Bethencourt
2017-12-06 19:16 ` [PATCH 2/3] staging: lustre: llite: Remove redundant else keyword Luis de Bethencourt
2017-12-06 19:16   ` [lustre-devel] " Luis de Bethencourt
2017-12-06 19:17 ` [PATCH 3/3] " Luis de Bethencourt
2017-12-06 19:17   ` [lustre-devel] " Luis de Bethencourt

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.