From: Dan Carpenter Date: Mon, 7 Apr 2014 22:39:03 +0000 (-0700) Subject: drivers/misc/sgi-gru/grukdump.c: cleanup gru_dump_context() a little X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=b6a83d928c652c092acd1ce79c19d44a1da9a6db;p=GitHub%2Fexynos8895%2Fandroid_kernel_samsung_universal8895.git drivers/misc/sgi-gru/grukdump.c: cleanup gru_dump_context() a little "ret" is zero here so we can remove the "!ret" part of the condition. "uhdr" is alread a __user pointer so we can remove the cast. Signed-off-by: Dan Carpenter Acked-by: Dimitri Sivanich Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- diff --git a/drivers/misc/sgi-gru/grukdump.c b/drivers/misc/sgi-gru/grukdump.c index 2bef3f76032a..a3700a56b8ff 100644 --- a/drivers/misc/sgi-gru/grukdump.c +++ b/drivers/misc/sgi-gru/grukdump.c @@ -178,10 +178,10 @@ static int gru_dump_context(struct gru_state *gru, int ctxnum, hdr.cbrcnt = cbrcnt; hdr.dsrcnt = dsrcnt; hdr.cch_locked = cch_locked; - if (!ret && copy_to_user((void __user *)uhdr, &hdr, sizeof(hdr))) - ret = -EFAULT; + if (copy_to_user(uhdr, &hdr, sizeof(hdr))) + return -EFAULT; - return ret ? ret : bytes; + return bytes; } int gru_dump_chiplet_request(unsigned long arg)