public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Dimitri Sivanich <sivanich@sgi.com>
To: Dan Carpenter <dan.carpenter@oracle.com>
Cc: linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org
Subject: Re: [patch 1/2] gru: unlocking should be conditional in gru_dump_context()
Date: Thu, 30 Jan 2014 08:01:13 -0600	[thread overview]
Message-ID: <20140130140113.GC15484@sgi.com> (raw)
In-Reply-To: <20140130121044.GB13267@elgon.mountain>

Acked-by: Dimitri Sivanich <sivanich@sgi.com>

On Thu, Jan 30, 2014 at 03:10:44PM +0300, Dan Carpenter wrote:
> I was reviewing this and noticed that unlocking should be conditional on
> the error path.  I've changed it to unlock and return directly since we
> only do it once and it seems unlikely to change in the near future.
> 
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> 
> diff --git a/drivers/misc/sgi-gru/grukdump.c b/drivers/misc/sgi-gru/grukdump.c
> index 9b2062d17327..2bef3f76032a 100644
> --- a/drivers/misc/sgi-gru/grukdump.c
> +++ b/drivers/misc/sgi-gru/grukdump.c
> @@ -139,8 +139,11 @@ static int gru_dump_context(struct gru_state *gru, int ctxnum,
>  
>  	ubuf += sizeof(hdr);
>  	ubufcch = ubuf;
> -	if (gru_user_copy_handle(&ubuf, cch))
> -		goto fail;
> +	if (gru_user_copy_handle(&ubuf, cch)) {
> +		if (cch_locked)
> +			unlock_cch_handle(cch);
> +		return -EFAULT;
> +	}
>  	if (cch_locked)
>  		ubufcch->delresp = 0;
>  	bytes = sizeof(hdr) + GRU_CACHE_LINE_BYTES;
> @@ -179,10 +182,6 @@ static int gru_dump_context(struct gru_state *gru, int ctxnum,
>  		ret = -EFAULT;
>  
>  	return ret ? ret : bytes;
> -
> -fail:
> -	unlock_cch_handle(cch);
> -	return -EFAULT;
>  }
>  
>  int gru_dump_chiplet_request(unsigned long arg)

      reply	other threads:[~2014-01-30 14:01 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-01-30 12:10 [patch 1/2] gru: unlocking should be conditional in gru_dump_context() Dan Carpenter
2014-01-30 14:01 ` Dimitri Sivanich [this message]

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=20140130140113.GC15484@sgi.com \
    --to=sivanich@sgi.com \
    --cc=dan.carpenter@oracle.com \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox