From: SF Markus Elfring <elfring@users.sourceforge.net>
To: Haavard Skinnemoen <hskinnemoen@gmail.com>,
Hans-Christian Egtvedt <egtvedt@samfundet.no>
Cc: LKML <linux-kernel@vger.kernel.org>, kernel-janitors@vger.kernel.org
Subject: [PATCH 3/3] AVR32: Return an error code only as a constant in sys_cacheflush()
Date: Wed, 18 Jan 2017 14:50:05 +0100 [thread overview]
Message-ID: <fec80877-6556-876c-72ca-f6ccb85e0700@users.sourceforge.net> (raw)
In-Reply-To: <308dc151-c874-dfe7-64f9-24a63fc66883@users.sourceforge.net>
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Wed, 18 Jan 2017 14:30:11 +0100
* Return an error code without storing it in an intermediate variable.
* Delete the local variable "ret" which became unnecessary with
this refactoring.
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
arch/avr32/mm/cache.c | 21 +++++----------------
1 file changed, 5 insertions(+), 16 deletions(-)
diff --git a/arch/avr32/mm/cache.c b/arch/avr32/mm/cache.c
index 85d635cd7b28..c893e5944390 100644
--- a/arch/avr32/mm/cache.c
+++ b/arch/avr32/mm/cache.c
@@ -126,30 +126,19 @@ void flush_icache_page(struct vm_area_struct *vma, struct page *page)
asmlinkage int sys_cacheflush(int operation, void __user *addr, size_t len)
{
- int ret;
-
- if (len > CACHEFLUSH_MAX_LEN) {
- ret = -EPERM;
- if (!capable(CAP_SYS_ADMIN))
- goto out;
- }
-
- ret = -EFAULT;
+ if (len > CACHEFLUSH_MAX_LEN && !capable(CAP_SYS_ADMIN))
+ return -EPERM;
if (!access_ok(VERIFY_WRITE, addr, len))
- goto out;
+ return -EFAULT;
switch (operation) {
case CACHE_IFLUSH:
flush_icache_range((unsigned long)addr,
(unsigned long)addr + len);
- ret = 0;
- break;
+ return 0;
default:
- ret = -EINVAL;
+ return -EINVAL;
}
-
-out:
- return ret;
}
void copy_to_user_page(struct vm_area_struct *vma, struct page *page,
--
2.11.0
next prev parent reply other threads:[~2017-01-18 13:50 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-01-18 13:45 [PATCH 0/3] AVR32: Fine-tuning for two function implementations SF Markus Elfring
2017-01-18 13:46 ` [PATCH 1/3] AVR32: Return directly after a failed access_ok() in setup_rt_frame() SF Markus Elfring
2017-01-18 13:48 ` [PATCH 2/3] AVR32: Delete an unnecessary variable initialisation " SF Markus Elfring
2017-01-18 13:50 ` SF Markus Elfring [this message]
2017-01-18 15:12 ` [PATCH 0/3] AVR32: Fine-tuning for two function implementations Hans-Christian Noren Egtvedt
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=fec80877-6556-876c-72ca-f6ccb85e0700@users.sourceforge.net \
--to=elfring@users.sourceforge.net \
--cc=egtvedt@samfundet.no \
--cc=hskinnemoen@gmail.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
Powered by JetHome