All of lore.kernel.org
 help / color / mirror / Atom feed
From: Greg KH <gregkh@linuxfoundation.org>
To: Haneen Mohammed <hamohammed.sa@gmail.com>
Cc: outreachy-kernel@googlegroups.com
Subject: Re: [Outreachy kernel] [PATCH] Staging: lustre: Remove unnecessary else after return
Date: Sun, 1 Mar 2015 16:48:24 -0800	[thread overview]
Message-ID: <20150302004824.GA12443@kroah.com> (raw)
In-Reply-To: <1425185971-22782-1-git-send-email-hamohammed.sa@gmail.com>

On Sun, Mar 01, 2015 at 07:59:31AM +0300, Haneen Mohammed wrote:
> This patch fix else is not usefull after break or return.
> Moves declaration to top addressing compiler warning:
> "ISO C90 forbids mixed declarations and code"
> Rename similar named variable in the function.
> 
> Signed-off-by: Haneen Mohammed <hamohammed.sa@gmail.com>
> ---
>  drivers/staging/lustre/lustre/ldlm/ldlm_lockd.c | 28 ++++++++++++-------------
>  1 file changed, 13 insertions(+), 15 deletions(-)
> 
> diff --git a/drivers/staging/lustre/lustre/ldlm/ldlm_lockd.c b/drivers/staging/lustre/lustre/ldlm/ldlm_lockd.c
> index cd15445..ad68e66 100644
> --- a/drivers/staging/lustre/lustre/ldlm/ldlm_lockd.c
> +++ b/drivers/staging/lustre/lustre/ldlm/ldlm_lockd.c
> @@ -444,28 +444,26 @@ static int ldlm_bl_to_thread(struct ldlm_namespace *ns,
>  			     struct list_head *cancels, int count,
>  			     ldlm_cancel_flags_t cancel_flags)
>  {
> +	struct ldlm_bl_work_item blwi, *pblwi;

Ick, don't use 'p' to define a pointer.

> +
>  	if (cancels && count == 0)
>  		return 0;
>  
>  	if (cancel_flags & LCF_ASYNC) {
> -		struct ldlm_bl_work_item *blwi;
> -
> -		OBD_ALLOC(blwi, sizeof(*blwi));
> -		if (blwi == NULL)
> +		OBD_ALLOC(pblwi, sizeof(*pblwi));
> +		if (pblwi == NULL)
>  			return -ENOMEM;
> -		init_blwi(blwi, ns, ld, cancels, count, lock, cancel_flags);
> +		init_blwi(pblwi, ns, ld, cancels, count, lock, cancel_flags);
>  
> -		return __ldlm_bl_to_thread(blwi, cancel_flags);
> -	} else {
> -		/* if it is synchronous call do minimum mem alloc, as it could
> -		 * be triggered from kernel shrinker
> -		 */
> -		struct ldlm_bl_work_item blwi;

I see what you are trying to do here, but it might be better just to
leave this alone.

thanks,

greg k-h


  reply	other threads:[~2015-03-02  0:48 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-01  4:59 [PATCH] Staging: lustre: Remove unnecessary else after return Haneen Mohammed
2015-03-02  0:48 ` Greg KH [this message]
  -- strict thread matches above, loose matches on Subject: below --
2015-02-20 21:05 aybuke ozdemir
2015-02-20 21:16 ` [Outreachy kernel] " Jes Sorensen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20150302004824.GA12443@kroah.com \
    --to=gregkh@linuxfoundation.org \
    --cc=hamohammed.sa@gmail.com \
    --cc=outreachy-kernel@googlegroups.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.