Commit 47553d42 authored by Ingo Molnar's avatar Ingo Molnar

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: default avatarIngo Molnar <mingo@kernel.org>
parent ef35b0fc
...@@ -656,7 +656,6 @@ int reserve_memtype(u64 start, u64 end, enum page_cache_mode req_type, ...@@ -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 free_memtype(u64 start, u64 end)
{ {
int err = -EINVAL;
int is_range_ram; int is_range_ram;
struct memtype *entry; struct memtype *entry;
...@@ -671,14 +670,10 @@ int free_memtype(u64 start, u64 end) ...@@ -671,14 +670,10 @@ int free_memtype(u64 start, u64 end)
return 0; return 0;
is_range_ram = pat_pagerange_is_ram(start, end); is_range_ram = pat_pagerange_is_ram(start, end);
if (is_range_ram == 1) { if (is_range_ram == 1)
return free_ram_pages_type(start, end);
err = free_ram_pages_type(start, end); if (is_range_ram < 0)
return err;
} else if (is_range_ram < 0) {
return -EINVAL; return -EINVAL;
}
spin_lock(&memtype_lock); spin_lock(&memtype_lock);
entry = memtype_erase(start, end); entry = memtype_erase(start, end);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment