History

treewide: use PHYS_ADDR_MAX to avoid type casting ULLONG_MAX

With PHYS_ADDR_MAX there is now a type safe variant for all bits set. Make use of it. Patch created using a semantic patch as follows: // <smpl> @@ typedef phys_addr_t; @@ -(phys_addr_t)ULLONG_MAX +PHYS_ADDR_MAX // </smpl>

Stefan Agner committed 8 years ago

Commit d7dc8991 parent 0825a6f9 files · +13 −13Browse files

Unified · Split

9 files
  1. arch/arm64/mm/init.c +3 −3
  2. arch/mips/kernel/setup.c +2 −2
  3. arch/powerpc/mm/mem.c +1 −1
  4. arch/sparc/mm/init_64.c +1 −1
  5. arch/x86/mm/init_32.c +1 −1
  6. arch/x86/mm/init_64.c +1 −1
  7. drivers/firmware/efi/arm-init.c +1 −1
  8. drivers/remoteproc/qcom_q6v5_pil.c +1 −1
  9. drivers/soc/qcom/mdt_loader.c +2 −2
arch/arm64/mm/init.c+3−3
@@ -310,7 +310,7 @@ static void __init arm64_memory_present(void) · 309 unmodified lines
310310 }
311311 #endif
312312
313−static phys_addr_t memory_limit = (phys_addr_t)ULLONG_MAX;
313+static phys_addr_t memory_limit = PHYS_ADDR_MAX;
314314
315315 /*
316316 * Limit the memory size that was specified via FDT.
@@ -401,7 +401,7 @@ void __init arm64_memblock_init(void) · 84 unmodified lines
401401 * high up in memory, add back the kernel region that must be accessible
402402 * via the linear mapping.
403403 */
404− if (memory_limit != (phys_addr_t)ULLONG_MAX) {
404+ if (memory_limit != PHYS_ADDR_MAX) {
405405 memblock_mem_limit_remove_map(memory_limit);
406406 memblock_add(__pa_symbol(_text), (u64)(_end - _text));
407407 }
@@ -666,7 +666,7 @@ __setup("keepinitrd", keepinitrd_setup); · 258 unmodified lines
666666 */
667667 static int dump_mem_limit(struct notifier_block *self, unsigned long v, void *p)
668668 {
669− if (memory_limit != (phys_addr_t)ULLONG_MAX) {
669+ if (memory_limit != PHYS_ADDR_MAX) {
670670 pr_emerg("Memory Limit: %llu MB\n", memory_limit >> 20);
671671 } else {
672672 pr_emerg("Memory Limit: none\n");
arch/mips/kernel/setup.c+2−2
@@ -93,7 +93,7 @@ void __init add_memory_region(phys_addr_t start, phys_addr_t size, long type) · 92 unmodified lines
9393 * If the region reaches the top of the physical address space, adjust
9494 * the size slightly so that (start + size) doesn't overflow
9595 */
96− if (start + size - 1 == (phys_addr_t)ULLONG_MAX)
96+ if (start + size - 1 == PHYS_ADDR_MAX)
9797 --size;
9898
9999 /* Sanity check */
@@ -376,7 +376,7 @@ static void __init bootmem_init(void) · 276 unmodified lines
376376 unsigned long reserved_end;
377377 unsigned long mapstart = ~0UL;
378378 unsigned long bootmap_size;
379− phys_addr_t ramstart = (phys_addr_t)ULLONG_MAX;
379+ phys_addr_t ramstart = PHYS_ADDR_MAX;
380380 bool bootmap_valid = false;
381381 int i;
382382
arch/powerpc/mm/mem.c+1−1
@@ -215,7 +215,7 @@ void __init mem_topology_setup(void) · 214 unmodified lines
215215 /* Place all memblock_regions in the same node and merge contiguous
216216 * memblock_regions
217217 */
218− memblock_set_node(0, (phys_addr_t)ULLONG_MAX, &memblock.memory, 0);
218+ memblock_set_node(0, PHYS_ADDR_MAX, &memblock.memory, 0);
219219 }
220220
221221 void __init initmem_init(void)
arch/sparc/mm/init_64.c+1−1
@@ -1620,7 +1620,7 @@ static void __init bootmem_init_nonnuma(void) · 1619 unmodified lines
16201620 (top_of_ram - total_ram) >> 20);
16211621
16221622 init_node_masks_nonnuma();
1623− memblock_set_node(0, (phys_addr_t)ULLONG_MAX, &memblock.memory, 0);
1623+ memblock_set_node(0, PHYS_ADDR_MAX, &memblock.memory, 0);
16241624 allocate_node_data(0);
16251625 node_set_online(0);
16261626 }
arch/x86/mm/init_32.c+1−1
@@ -692,7 +692,7 @@ void __init initmem_init(void) · 691 unmodified lines
692692 high_memory = (void *) __va(max_low_pfn * PAGE_SIZE - 1) + 1;
693693 #endif
694694
695− memblock_set_node(0, (phys_addr_t)ULLONG_MAX, &memblock.memory, 0);
695+ memblock_set_node(0, PHYS_ADDR_MAX, &memblock.memory, 0);
696696 sparse_memory_present_with_active_regions(0);
697697
698698 #ifdef CONFIG_FLATMEM
arch/x86/mm/init_64.c+1−1
@@ -742,7 +742,7 @@ kernel_physical_mapping_init(unsigned long paddr_start, · 741 unmodified lines
742742 #ifndef CONFIG_NUMA
743743 void __init initmem_init(void)
744744 {
745− memblock_set_node(0, (phys_addr_t)ULLONG_MAX, &memblock.memory, 0);
745+ memblock_set_node(0, PHYS_ADDR_MAX, &memblock.memory, 0);
746746 }
747747 #endif
748748
drivers/firmware/efi/arm-init.c+1−1
@@ -193,7 +193,7 @@ static __init void reserve_regions(void) · 192 unmodified lines
193193 * uses its own memory map instead.
194194 */
195195 memblock_dump_all();
196− memblock_remove(0, (phys_addr_t)ULLONG_MAX);
196+ memblock_remove(0, PHYS_ADDR_MAX);
197197
198198 for_each_efi_memory_desc(md) {
199199 paddr = md->phys_addr;
drivers/remoteproc/qcom_q6v5_pil.c+1−1
@@ -686,7 +686,7 @@ static int q6v5_mpss_load(struct q6v5 *qproc) · 685 unmodified lines
686686 struct elf32_hdr *ehdr;
687687 phys_addr_t mpss_reloc;
688688 phys_addr_t boot_addr;
689− phys_addr_t min_addr = (phys_addr_t)ULLONG_MAX;
689+ phys_addr_t min_addr = PHYS_ADDR_MAX;
690690 phys_addr_t max_addr = 0;
691691 bool relocate = false;
692692 char seg_name[10];
drivers/soc/qcom/mdt_loader.c+2−2
@@ -50,7 +50,7 @@ ssize_t qcom_mdt_get_size(const struct firmware *fw) · 49 unmodified lines
5050 const struct elf32_phdr *phdrs;
5151 const struct elf32_phdr *phdr;
5252 const struct elf32_hdr *ehdr;
53− phys_addr_t min_addr = (phys_addr_t)ULLONG_MAX;
53+ phys_addr_t min_addr = PHYS_ADDR_MAX;
5454 phys_addr_t max_addr = 0;
5555 int i;
5656
@@ -97,7 +97,7 @@ int qcom_mdt_load(struct device *dev, const struct firmware *fw, · 40 unmodified lines
9797 const struct elf32_hdr *ehdr;
9898 const struct firmware *seg_fw;
9999 phys_addr_t mem_reloc;
100− phys_addr_t min_addr = (phys_addr_t)ULLONG_MAX;
100+ phys_addr_t min_addr = PHYS_ADDR_MAX;
101101 phys_addr_t max_addr = 0;
102102 size_t fw_name_len;
103103 ssize_t offset;

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t