The patch titled Subject: mm/hmm.c: fix unused variable warnings has been added to the -mm tree. Its filename is mm-hmm-fix-unused-variable-warnings.patch This patch should soon appear at http://ozlabs.org/~akpm/mmots/broken-out/mm-hmm-fix-unused-variable-warnings.patch and later at http://ozlabs.org/~akpm/mmotm/broken-out/mm-hmm-fix-unused-variable-warnings.patch Before you just go and hit "reply", please: a) Consider who else should be cc'ed b) Prefer to cc a suitable mailing list as well c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's *** Remember to use Documentation/process/submit-checklist.rst when testing your code *** The -mm tree is included into linux-next and is updated there every 3-4 working days ------------------------------------------------------ From: Arnd Bergmann <arnd@xxxxxxxx> Subject: mm/hmm.c: fix unused variable warnings When CONFIG_HUGETLB_PAGE is disabled, the only use of the variable 'h' is compiled out, and the compiler thinks it is unnecessary: mm/hmm.c: In function 'hmm_range_snapshot': mm/hmm.c:1015:19: error: unused variable 'h' [-Werror=unused-variable] struct hstate *h = hstate_vma(vma); Rephrase the code to avoid the temporary variable instead, so the compiler stops warning. Link: http://lkml.kernel.org/r/20190304200026.1140281-1-arnd@xxxxxxxx Fixes: 5409a90d4212 ("mm/hmm: support hugetlbfs (snapshotting, faulting and DMA mapping)") Signed-off-by: Arnd Bergmann <arnd@xxxxxxxx> Reviewed-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> Cc: Jérôme Glisse <jglisse@xxxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- --- a/mm/hmm.c~mm-hmm-fix-unused-variable-warnings +++ a/mm/hmm.c @@ -1012,9 +1012,8 @@ long hmm_range_snapshot(struct hmm_range return -EFAULT; if (is_vm_hugetlb_page(vma)) { - struct hstate *h = hstate_vma(vma); - - if (huge_page_shift(h) != range->page_shift && + if (range->page_shift != + huge_page_shift(hstate_vma(vma)) && range->page_shift != PAGE_SHIFT) return -EINVAL; } else { @@ -1115,9 +1114,8 @@ long hmm_range_fault(struct hmm_range *r return -EFAULT; if (is_vm_hugetlb_page(vma)) { - struct hstate *h = hstate_vma(vma); - - if (huge_page_shift(h) != range->page_shift && + if (range->page_shift != + huge_page_shift(hstate_vma(vma)) && range->page_shift != PAGE_SHIFT) return -EINVAL; } else { _ Patches currently in -mm which might be from arnd@xxxxxxxx are kasan-fix-kasan_check_read-write-definitions.patch mm-hmm-fix-unused-variable-warnings.patch