Message ID | 1614603421-2681-1-git-send-email-wangqing@vivo.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | mm: delete bool "migrated" | expand |
On Mon, 1 Mar 2021 20:57:01 +0800 Wang Qing <wangqing@vivo.com> wrote: > Smatch gives the warning: > do_numa_page() warn: assigning (-11) to unsigned variable 'migrated' > > ... > > --- a/mm/memory.c > +++ b/mm/memory.c > @@ -4102,7 +4102,6 @@ static vm_fault_t do_numa_page(struct vm_fault *vmf) > int page_nid = NUMA_NO_NODE; > int last_cpupid; > int target_nid; > - bool migrated = false; > pte_t pte, old_pte; > bool was_writable = pte_savedwrite(vmf->orig_pte); > int flags = 0; > @@ -4172,8 +4171,7 @@ static vm_fault_t do_numa_page(struct vm_fault *vmf) > } > > /* Migrate to the requested node */ > - migrated = migrate_misplaced_page(page, vma, target_nid); > - if (migrated) { > + if (migrate_misplaced_page(page, vma, target_nid)) { > page_nid = target_nid; > flags |= TNF_MIGRATED; > } else Looks right. Methinks both migrate_misplaced_page() and numamigrate_isolate_page() should return bools. (And that their return values should be documented!)
diff --git a/mm/memory.c b/mm/memory.c index 784249f..d8125df --- a/mm/memory.c +++ b/mm/memory.c @@ -4102,7 +4102,6 @@ static vm_fault_t do_numa_page(struct vm_fault *vmf) int page_nid = NUMA_NO_NODE; int last_cpupid; int target_nid; - bool migrated = false; pte_t pte, old_pte; bool was_writable = pte_savedwrite(vmf->orig_pte); int flags = 0; @@ -4172,8 +4171,7 @@ static vm_fault_t do_numa_page(struct vm_fault *vmf) } /* Migrate to the requested node */ - migrated = migrate_misplaced_page(page, vma, target_nid); - if (migrated) { + if (migrate_misplaced_page(page, vma, target_nid)) { page_nid = target_nid; flags |= TNF_MIGRATED; } else
Smatch gives the warning: do_numa_page() warn: assigning (-11) to unsigned variable 'migrated' Signed-off-by: Wang Qing <wangqing@vivo.com> --- mm/memory.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)