Staging: lustre: Remove unnecessary braces of single statement block
PATCH 1/1 Staging: lustre: Remove unnecessary braces of single statement block
Remove unnecessary braces of single statement block else
--- drivers/staging/lustre/lustre/llite/dcache.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/staging/lustre/lustre/llite/dcache.c +2 -4
@@ -193,13 +193,11 @@ int ll_d_init(struct dentry *de)if (likely (!de->d_fsdata)) { de->d_fsdata = lld;__d_lustre_invalidate (de); - }else { + }else kfree (lld); - }spin_unlock (&de->d_lock); - }else { + }else return -ENOMEM ; - } }LASSERT (de->d_op == &ll_d_ops);
Signature · 1 line
1.8.3.4
Quoted 1 line · Sandhya Bankar
Remove unnecessary braces of single statement block else
Actually, the rule is that if one branch has braces, the other should too. Documentation/CodingStyle says the following:
Do not unnecessarily use braces where a single statement will do.
if (condition) action();
and
if (condition)
do_this();
else
do_that();This does not apply if only one branch of a conditional statement is a single statement; in the latter case use braces in both branches:
if (condition) {
do_this();
do_that();
} else {
otherwise();
}julia
Quoted 37 lines
Signed-off-by Sandhya Bankar <[email protected]>--- drivers/staging/lustre/lustre/llite/dcache.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)drivers/staging/lustre/lustre/llite/dcache.c +2
-5@@ -193,13 +193,11 @@ int ll_d_init(struct dentry *de)if (likely (!de->d_fsdata)) { de->d_fsdata = lld;__d_lustre_invalidate (de); - }else { + }else kfree (lld); - }spin_unlock (&de->d_lock); - }else { + }else return -ENOMEM ; - } }LASSERT (de->d_op == &ll_d_ops); --1.8.3.4
--
You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/20160221041414.GA2801%40sandhya.
For more options, visit https://groups.google.com/d/optout.