All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Staging: lustre: Remove unnecessary braces of single statement block
@ 2016-02-21  4:14 Sandhya Bankar
  2016-02-21 12:22 ` [Outreachy kernel] " Julia Lawall
  0 siblings, 1 reply; 2+ messages in thread
From: Sandhya Bankar @ 2016-02-21  4:14 UTC (permalink / raw)
  To: outreachy-kernel

Remove unnecessary braces of single statement block else


Signed-off-by: Sandhya Bankar <bankarsandhya512@gmail.com>
---
 drivers/staging/lustre/lustre/llite/dcache.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/lustre/lustre/llite/dcache.c b/drivers/staging/lustre/lustre/llite/dcache.c
index bc179e5..e3b98b7 100644
--- a/drivers/staging/lustre/lustre/llite/dcache.c
+++ b/drivers/staging/lustre/lustre/llite/dcache.c
@@ -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



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

* Re: [Outreachy kernel] [PATCH] Staging: lustre: Remove unnecessary braces of single statement block
  2016-02-21  4:14 [PATCH] Staging: lustre: Remove unnecessary braces of single statement block Sandhya Bankar
@ 2016-02-21 12:22 ` Julia Lawall
  0 siblings, 0 replies; 2+ messages in thread
From: Julia Lawall @ 2016-02-21 12:22 UTC (permalink / raw)
  To: Sandhya Bankar; +Cc: outreachy-kernel

On Sun, 21 Feb 2016, Sandhya Bankar wrote:

> 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

>
>
> Signed-off-by: Sandhya Bankar <bankarsandhya512@gmail.com>
> ---
>  drivers/staging/lustre/lustre/llite/dcache.c | 6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/staging/lustre/lustre/llite/dcache.c b/drivers/staging/lustre/lustre/llite/dcache.c
> index bc179e5..e3b98b7 100644
> --- a/drivers/staging/lustre/lustre/llite/dcache.c
> +++ b/drivers/staging/lustre/lustre/llite/dcache.c
> @@ -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 outreachy-kernel+unsubscribe@googlegroups.com.
> To post to this group, send email to outreachy-kernel@googlegroups.com.
> 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.
>


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

end of thread, other threads:[~2016-02-21 12:22 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-02-21  4:14 [PATCH] Staging: lustre: Remove unnecessary braces of single statement block Sandhya Bankar
2016-02-21 12:22 ` [Outreachy kernel] " Julia Lawall

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.