All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] staging: lustre: lnet: Remove an else after an if-return
@ 2015-11-01 14:29 Anchal Jain
  2015-11-04  3:41 ` [Outreachy kernel] " Greg KH
  0 siblings, 1 reply; 2+ messages in thread
From: Anchal Jain @ 2015-11-01 14:29 UTC (permalink / raw)
  To: outreachy-kernel

The original motivation of the patch was to remove an 
else after an if branch that ends in a return. This 
removal required the removal of a list of other things. 
That are needed to make the code either correct or 
acceptable to checkpatch, for example:removing a blank 
line, removing braces, etc.

Remove unnecessary use of else that required the
removal of corresponding braces. And then the
declaration of hash was movedup to the beginning of the
function is required, but the initialization was left
where it was. And it also required remove the blank
line and add some new lines before the if and below the
declaration of hash.

Signed-off-by: Anchal Jain <anchalj109@gmail.com>

---
 drivers/staging/lustre/lnet/lnet/lib-ptl.c | 16 +++++++---------
 1 file changed, 7 insertions(+), 9 deletions(-)

diff --git a/drivers/staging/lustre/lnet/lnet/lib-ptl.c b/drivers/staging/lustre/lnet/lnet/lib-ptl.c
index b4f573a..aec06f9 100644
--- a/drivers/staging/lustre/lnet/lnet/lib-ptl.c
+++ b/drivers/staging/lustre/lnet/lnet/lib-ptl.c
@@ -357,16 +357,14 @@ lnet_mt_match_head(struct lnet_match_table *mtable,
 		   lnet_process_id_t id, __u64 mbits)
 {
 	struct lnet_portal *ptl = the_lnet.ln_portals[mtable->mt_portal];
-
-	if (lnet_ptl_is_wildcard(ptl)) {
+	 unsigned long hash;
+	if (lnet_ptl_is_wildcard(ptl))
 		return &mtable->mt_mhash[mbits & LNET_MT_HASH_MASK];
-	} else {
-		unsigned long hash = mbits + id.nid + id.pid;
-
-		LASSERT(lnet_ptl_is_unique(ptl));
-		hash = hash_long(hash, LNET_MT_HASH_BITS);
-		return &mtable->mt_mhash[hash];
-	}
+	hash = mbits + id.nid + id.pid;
+		
+	LASSERT(lnet_ptl_is_unique(ptl));
+	hash = hash_long(hash, LNET_MT_HASH_BITS);
+	return &mtable->mt_mhash[hash];
 }
 
 int
-- 
1.9.1



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

* Re: [Outreachy kernel] [PATCH] staging: lustre: lnet: Remove an else after an if-return
  2015-11-01 14:29 [PATCH] staging: lustre: lnet: Remove an else after an if-return Anchal Jain
@ 2015-11-04  3:41 ` Greg KH
  0 siblings, 0 replies; 2+ messages in thread
From: Greg KH @ 2015-11-04  3:41 UTC (permalink / raw)
  To: Anchal Jain; +Cc: outreachy-kernel

On Sun, Nov 01, 2015 at 07:59:32PM +0530, Anchal Jain wrote:
> The original motivation of the patch was to remove an 
> else after an if branch that ends in a return. This 
> removal required the removal of a list of other things. 
> That are needed to make the code either correct or 
> acceptable to checkpatch, for example:removing a blank 
> line, removing braces, etc.
> 
> Remove unnecessary use of else that required the
> removal of corresponding braces. And then the
> declaration of hash was movedup to the beginning of the
> function is required, but the initialization was left
> where it was. And it also required remove the blank
> line and add some new lines before the if and below the
> declaration of hash.
> 
> Signed-off-by: Anchal Jain <anchalj109@gmail.com>
> 
> ---
>  drivers/staging/lustre/lnet/lnet/lib-ptl.c | 16 +++++++---------
>  1 file changed, 7 insertions(+), 9 deletions(-)
> 
> diff --git a/drivers/staging/lustre/lnet/lnet/lib-ptl.c b/drivers/staging/lustre/lnet/lnet/lib-ptl.c
> index b4f573a..aec06f9 100644
> --- a/drivers/staging/lustre/lnet/lnet/lib-ptl.c
> +++ b/drivers/staging/lustre/lnet/lnet/lib-ptl.c
> @@ -357,16 +357,14 @@ lnet_mt_match_head(struct lnet_match_table *mtable,
>  		   lnet_process_id_t id, __u64 mbits)
>  {
>  	struct lnet_portal *ptl = the_lnet.ln_portals[mtable->mt_portal];
> -
> -	if (lnet_ptl_is_wildcard(ptl)) {
> +	 unsigned long hash;

Very odd indentation :(



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

end of thread, other threads:[~2015-11-04  5:56 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-11-01 14:29 [PATCH] staging: lustre: lnet: Remove an else after an if-return Anchal Jain
2015-11-04  3:41 ` [Outreachy kernel] " Greg KH

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.