2017-12-06 19:17:29

by Luis de Bethencourt

[permalink] [raw]
Subject: [PATCH 1/3] staging: lustre: llite: Remove else after goto

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 <[email protected]>
---

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


2017-12-06 19:17:38

by Luis de Bethencourt

[permalink] [raw]
Subject: [PATCH 2/3] staging: lustre: llite: Remove redundant else keyword

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

Signed-off-by: Luis de Bethencourt <[email protected]>
---
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

2017-12-06 19:17:53

by Luis de Bethencourt

[permalink] [raw]
Subject: [PATCH 3/3] staging: lustre: llite: Remove redundant else keyword

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

Signed-off-by: Luis de Bethencourt <[email protected]>
---
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