Skip to content

Commit

Permalink
MIPS: Make virt_addr_valid() return bool
Browse files Browse the repository at this point in the history
virt_addr_valid() really returns a boolean value, but currently uses an
integer to represent it. Switch to the bool type to make it clearer that
we really are returning a true or false value.

Signed-off-by: Paul Burton <paul.burton@mips.com>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Tested-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Cc: linux-mips@vger.kernel.org
  • Loading branch information
Paul Burton committed May 29, 2019
1 parent 074a1e1 commit 31875a5
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion arch/mips/include/asm/page.h
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ static inline int pfn_valid(unsigned long pfn)
#define virt_to_pfn(kaddr) PFN_DOWN(virt_to_phys((void *)(kaddr)))
#define virt_to_page(kaddr) pfn_to_page(virt_to_pfn(kaddr))

extern int __virt_addr_valid(const volatile void *kaddr);
extern bool __virt_addr_valid(const volatile void *kaddr);
#define virt_addr_valid(kaddr) \
__virt_addr_valid((const volatile void *) (kaddr))

Expand Down
4 changes: 2 additions & 2 deletions arch/mips/mm/mmap.c
Original file line number Diff line number Diff line change
Expand Up @@ -201,12 +201,12 @@ unsigned long arch_randomize_brk(struct mm_struct *mm)
return ret;
}

int __virt_addr_valid(const volatile void *kaddr)
bool __virt_addr_valid(const volatile void *kaddr)
{
unsigned long vaddr = (unsigned long)vaddr;

if ((vaddr < PAGE_OFFSET) || (vaddr >= MAP_BASE))
return 0;
return false;

return pfn_valid(PFN_DOWN(virt_to_phys(kaddr)));
}
Expand Down

0 comments on commit 31875a5

Please sign in to comment.