* [PATCH] mm: remove unnecessary local variable addr in __get_user_pages_fast()
@ 2018-09-25 2:14 Wei Yang
0 siblings, 0 replies; only message in thread
From: Wei Yang @ 2018-09-25 2:14 UTC (permalink / raw)
To: akpm, dan.j.williams; +Cc: linux-mm, Wei Yang
The local variable *addr* in __get_user_pages_fast() is just a shadow of
*start*. Since *start* never changes after assigned to *addr*, it is fine
to replace *start* with it.
Also the meaning of [start, end] is more obvious than [addr, end] when
passed to gup_pgd_range().
Signed-off-by: Wei Yang <richard.weiyang@gmail.com>
---
mm/gup.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/mm/gup.c b/mm/gup.c
index fc5f98069f4e..1a80775440cb 100644
--- a/mm/gup.c
+++ b/mm/gup.c
@@ -1780,12 +1780,11 @@ bool gup_fast_permitted(unsigned long start, int nr_pages, int write)
int __get_user_pages_fast(unsigned long start, int nr_pages, int write,
struct page **pages)
{
- unsigned long addr, len, end;
+ unsigned long len, end;
unsigned long flags;
int nr = 0;
start &= PAGE_MASK;
- addr = start;
len = (unsigned long) nr_pages << PAGE_SHIFT;
end = start + len;
@@ -1807,7 +1806,7 @@ int __get_user_pages_fast(unsigned long start, int nr_pages, int write,
if (gup_fast_permitted(start, nr_pages, write)) {
local_irq_save(flags);
- gup_pgd_range(addr, end, write, pages, &nr);
+ gup_pgd_range(start, end, write, pages, &nr);
local_irq_restore(flags);
}
--
2.15.1
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2018-09-25 2:14 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-09-25 2:14 [PATCH] mm: remove unnecessary local variable addr in __get_user_pages_fast() Wei Yang
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).