On Sat, Aug 17, 2019 at 11:00:13AM +0800, Zhaoyang Huang wrote:
> #ifdef CONFIG_HAVE_ARCH_PFN_VALID
> int pfn_valid(unsigned long pfn)
> {
> - return memblock_is_map_memory(__pfn_to_phys(pfn));
> + return (pfn > max_pfn) ?
> + false : memblock_is_map_memory(__pfn_to_phys(pfn));
> }
This is a really awkward way to use the ternary operator. It's easier to
read if you just:
+ if (pfn > max_pfn)
+ return 0;
return memblock_is_map_memory(__pfn_to_phys(pfn));
(if you really wanted to be clever ... er, obscure, you'd've written:
return (pfn <= max_pfn) && memblock_is_map_memory(__pfn_to_phys(pfn));
... but don't do that)
Also, why is this diverged between arm and arm64?