@@ -1358,10 +1358,11 @@ static inline int pfn_section_valid(struct mem_section *ms, unsigned long pfn)
static inline int pfn_valid(unsigned long pfn)
{
struct mem_section *ms;
+ unsigned long sec_nr = pfn_to_section_nr(pfn);
- if (pfn_to_section_nr(pfn) >= NR_MEM_SECTIONS)
+ if (pfn >= NR_MEM_SECTIONS)
return 0;
- ms = __nr_to_section(pfn_to_section_nr(pfn));
+ ms = __nr_to_section(sec_nr);
if (!valid_section(ms))
return 0;
/*
@@ -1374,9 +1375,11 @@ static inline int pfn_valid(unsigned long pfn)
static inline int pfn_present(unsigned long pfn)
{
- if (pfn_to_section_nr(pfn) >= NR_MEM_SECTIONS)
+ unsigned long sec_nr = pfn_to_section_nr(pfn);
+
+ if (sec_nr >= NR_MEM_SECTIONS)
return 0;
- return present_section(__nr_to_section(pfn_to_section_nr(pfn)));
+ return present_section(__nr_to_section(sec_nr));
}
static inline unsigned long next_present_section_nr(unsigned long section_nr)