summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIngo Molnar <mingo@kernel.org>2019-11-19 12:18:56 +0300
committerIngo Molnar <mingo@kernel.org>2019-12-10 12:12:55 +0300
commit47553d42c55f7b85e72ce6f3a18030102f8f93a3 (patch)
tree75a39067ea3e3856b02df4b486c9d07059286348
parentef35b0fcee23d7636daa4bed62bceeaba4eed918 (diff)
downloadlinux-47553d42c55f7b85e72ce6f3a18030102f8f93a3.tar.xz
x86/mm/pat: Simplify the free_memtype() control flow
Simplify/streamline the quirky handling of the pat_pagerange_is_ram() logic, and get rid of the 'err' local variable. Signed-off-by: Ingo Molnar <mingo@kernel.org>
-rw-r--r--arch/x86/mm/pat.c11
1 files changed, 3 insertions, 8 deletions
diff --git a/arch/x86/mm/pat.c b/arch/x86/mm/pat.c
index ea7da7e62e17..af049920e59a 100644
--- a/arch/x86/mm/pat.c
+++ b/arch/x86/mm/pat.c
@@ -656,7 +656,6 @@ int reserve_memtype(u64 start, u64 end, enum page_cache_mode req_type,
int free_memtype(u64 start, u64 end)
{
- int err = -EINVAL;
int is_range_ram;
struct memtype *entry;
@@ -671,14 +670,10 @@ int free_memtype(u64 start, u64 end)
return 0;
is_range_ram = pat_pagerange_is_ram(start, end);
- if (is_range_ram == 1) {
-
- err = free_ram_pages_type(start, end);
-
- return err;
- } else if (is_range_ram < 0) {
+ if (is_range_ram == 1)
+ return free_ram_pages_type(start, end);
+ if (is_range_ram < 0)
return -EINVAL;
- }
spin_lock(&memtype_lock);
entry = memtype_erase(start, end);