summaryrefslogtreecommitdiff
path: root/drivers/misc/sgi-gru
diff options
context:
space:
mode:
authorDan Carpenter <dan.carpenter@oracle.com>2014-02-10 14:25:30 -0800
committerLinus Torvalds <torvalds@linux-foundation.org>2014-02-10 16:01:39 -0800
commit49d3d6c37a322117b1eeb410a49165bb3d0441f7 (patch)
tree93e0725ad190f9bb8b4aa55404fcea5480eaf821 /drivers/misc/sgi-gru
parentb28a960c42fcd9cfc987441fa6d1c1a471f0f9ed (diff)
drivers/misc/sgi-gru/grukdump.c: unlocking should be conditional in gru_dump_context()
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> Acked-by: Dimitri Sivanich <sivanich@sgi.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/misc/sgi-gru')
-rw-r--r--drivers/misc/sgi-gru/grukdump.c11
1 files changed, 5 insertions, 6 deletions
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)