On Mon, 2017-12-11 at 21:55 -0500, Yaowei Bai wrote: > This patch makes memblock_is_map/region_memory return bool due to these > two functions only using either true or false as its return value. [] > @@ -1690,13 +1690,13 @@ int __init_memblock memblock_search_pfn_nid(unsigned > long pfn, > * RETURNS: > * 0 if false, non-zero if true > */ > -int __init_memblock memblock_is_region_memory(phys_addr_t base, phys_addr_t > size) > +bool __init_memblock memblock_is_region_memory(phys_addr_t base, phys_addr_t > size) > { > int idx = memblock_search(&memblock.memory, base); > phys_addr_t end = base + memblock_cap_size(base, &size); > > if (idx == -1) > - return 0; > + return false; > return (memblock.memory.regions[idx].base + > memblock.memory.regions[idx].size) >= end; > }
I'd be more inclined to use a temporary for memblock.memory.regions[idx] so the function was something like: int __init_memblock memblock_is_region_memory(phys_addr_t base, phys_addr_t size) { phys_addr_t end; struct memblock_region *region; int idx = memblock_search(&memblock.memory, base); if (idx == -1) return 0; end = base + memblock_cap_size(base, &size); region = &memblock.memory.regions[idx]; return (region->base + region->size) >= end; } Maybe change to bool at your option.