[tip:WIP.x86/boot 51/55] arch/x86/kernel/e820.c:120:10-11: WARNING: return of 0/1 in function 'e820__mapped_all' with return type bool

From: kbuild test robot
Date: Sat Jan 28 2017 - 20:47:03 EST


tree: https://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git WIP.x86/boot
head: 0c6fc11ac343c82d4a2f8348fa6f829e07c12554
commit: 81b3e090fa1f237d49c8feb2fa4afe2aabd3a4ff [51/55] x86/boot/e820: Use bool in query APIs


coccinelle warnings: (new ones prefixed by >>)

>> arch/x86/kernel/e820.c:120:10-11: WARNING: return of 0/1 in function 'e820__mapped_all' with return type bool
>> arch/x86/kernel/e820.c:82:9-10: WARNING: return of 0/1 in function 'e820__mapped_any' with return type bool
--
>> arch/x86/pci/mmconfig-shared.c:462:9-10: WARNING: return of 0/1 in function 'is_mmconf_reserved' with return type bool
>> arch/x86/pci/mmconfig-shared.c:502:10-11: WARNING: return of 0/1 in function 'pci_mmcfg_check_reserved' with return type bool

vim +/e820__mapped_all +120 arch/x86/kernel/e820.c

e5540f875 Ingo Molnar 2017-01-28 76 struct e820_entry *entry = &e820_table->entries[i];
b79cd8f12 Yinghai Lu 2008-05-11 77
e5540f875 Ingo Molnar 2017-01-28 78 if (type && entry->type != type)
b79cd8f12 Yinghai Lu 2008-05-11 79 continue;
e5540f875 Ingo Molnar 2017-01-28 80 if (entry->addr >= end || entry->addr + entry->size <= start)
b79cd8f12 Yinghai Lu 2008-05-11 81 continue;
b79cd8f12 Yinghai Lu 2008-05-11 @82 return 1;
b79cd8f12 Yinghai Lu 2008-05-11 83 }
b79cd8f12 Yinghai Lu 2008-05-11 84 return 0;
b79cd8f12 Yinghai Lu 2008-05-11 85 }
3bce64f01 Ingo Molnar 2017-01-28 86 EXPORT_SYMBOL_GPL(e820__mapped_any);
b79cd8f12 Yinghai Lu 2008-05-11 87
b79cd8f12 Yinghai Lu 2008-05-11 88 /*
640e1b38b Ingo Molnar 2017-01-28 89 * This function checks if the entire <start,end> range is mapped with 'type'.
b79cd8f12 Yinghai Lu 2008-05-11 90 *
640e1b38b Ingo Molnar 2017-01-28 91 * Note: this function only works correctly once the E820 table is sorted and
640e1b38b Ingo Molnar 2017-01-28 92 * not-overlapping (at least for the range specified), which is the case normally.
b79cd8f12 Yinghai Lu 2008-05-11 93 */
81b3e090f Ingo Molnar 2017-01-28 94 bool __init e820__mapped_all(u64 start, u64 end, enum e820_type type)
b79cd8f12 Yinghai Lu 2008-05-11 95 {
b79cd8f12 Yinghai Lu 2008-05-11 96 int i;
b79cd8f12 Yinghai Lu 2008-05-11 97
bf495573f Ingo Molnar 2017-01-27 98 for (i = 0; i < e820_table->nr_entries; i++) {
e5540f875 Ingo Molnar 2017-01-28 99 struct e820_entry *entry = &e820_table->entries[i];
b79cd8f12 Yinghai Lu 2008-05-11 100
e5540f875 Ingo Molnar 2017-01-28 101 if (type && entry->type != type)
b79cd8f12 Yinghai Lu 2008-05-11 102 continue;
640e1b38b Ingo Molnar 2017-01-28 103
640e1b38b Ingo Molnar 2017-01-28 104 /* Is the region (part) in overlap with the current region? */
e5540f875 Ingo Molnar 2017-01-28 105 if (entry->addr >= end || entry->addr + entry->size <= start)
b79cd8f12 Yinghai Lu 2008-05-11 106 continue;
b79cd8f12 Yinghai Lu 2008-05-11 107
640e1b38b Ingo Molnar 2017-01-28 108 /*
640e1b38b Ingo Molnar 2017-01-28 109 * If the region is at the beginning of <start,end> we move
640e1b38b Ingo Molnar 2017-01-28 110 * 'start' to the end of the region since it's ok until there
b79cd8f12 Yinghai Lu 2008-05-11 111 */
e5540f875 Ingo Molnar 2017-01-28 112 if (entry->addr <= start)
e5540f875 Ingo Molnar 2017-01-28 113 start = entry->addr + entry->size;
640e1b38b Ingo Molnar 2017-01-28 114
b79cd8f12 Yinghai Lu 2008-05-11 115 /*
640e1b38b Ingo Molnar 2017-01-28 116 * If 'start' is now at or beyond 'end', we're done, full
640e1b38b Ingo Molnar 2017-01-28 117 * coverage of the desired range exists:
b79cd8f12 Yinghai Lu 2008-05-11 118 */
b79cd8f12 Yinghai Lu 2008-05-11 119 if (start >= end)
b79cd8f12 Yinghai Lu 2008-05-11 @120 return 1;
b79cd8f12 Yinghai Lu 2008-05-11 121 }
b79cd8f12 Yinghai Lu 2008-05-11 122 return 0;
b79cd8f12 Yinghai Lu 2008-05-11 123 }

:::::: The code at line 120 was first introduced by commit
:::::: b79cd8f1268bab57ff85b19d131f7f23deab2dee x86: make e820.c to have common functions

:::::: TO: Yinghai Lu <yhlu.kernel@xxxxxxxxx>
:::::: CC: Thomas Gleixner <tglx@xxxxxxxxxxxxx>

---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation