From patchwork Mon Mar 4 20:00:10 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 159584 Delivered-To: patch@linaro.org Received: by 2002:a02:5cc1:0:0:0:0:0 with SMTP id w62csp4154271jad; Mon, 4 Mar 2019 12:00:50 -0800 (PST) X-Google-Smtp-Source: APXvYqx7WxR2kkNDKV85hDJa7TNPKigmrc0HxZYGj2EyerxZD0zK4kXwD4k1MoelC5bHV7jA/kNx X-Received: by 2002:a17:902:147:: with SMTP id 65mr22025985plb.116.1551729650833; Mon, 04 Mar 2019 12:00:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1551729650; cv=none; d=google.com; s=arc-20160816; b=R4NmAt5mZGvIdAaqWsal2XNrjWLXPEs8X4OUOueZdUwB/6EeA/MKvXDhjiuqVvslLU 6oCwabPXWoVSALRnn0jGoC8YO3gvTvcHtRqk+4xgEK0vQKyVhqBgeai5T0RDFm53NsoO Fzry1AjtCkKKMQzbe7j/C8cLLjhVkt1ilRngXAd+cGsRvNDzBe+gkm8uuo2CIBXqw+Oo 4myNaUyvDZ8wVH4lx/xxFFzltUmzbBQVJtaBcN94M3EYrQbaFfmaWWNyoyvM7dfYkqJc S6D3cPyAbuDGdFsOE/DM2fewZPxeo6i+vCkH0eGuPKLQuphAUkA3u0QEgTUIWKve3pH7 WMwA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=ZfakE/CbS8xrs43Lrg/OoZsO+6PpNSqmllDKU14czno=; b=EWdAM1v6rk5madrfPxwZZJPaI1yCG3qDtO7LtXjz1w180miV0jrJrZ8n2Wbn2Ku1Xv F0amKYMMxIJ6emXGZyrOcMI/1Oh2GRyYNHQ6onlGsE8/JrlnnleviN4j/wkQKNnDgpSc vEBpnMECj1+cbp91DsGICBAgwjcCaR/Qtm4Ju59xviLo/nHYvKjwtJtFqG/tnwnumkCP jL2R43bPYFv7wEcyOPBlGGpcW6LjO9cJwJ2mNwJg6UwxkHVUsF7YslmuiFcYZkprEZbn nA400KQ/zllQjPA3zdegMqLLqaeb9lrE9HllEoCyo+FLHPCZU0oCArIib3rBE+a93SBq HUXg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h7si6061107pll.172.2019.03.04.12.00.50; Mon, 04 Mar 2019 12:00:50 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726327AbfCDUAs (ORCPT + 31 others); Mon, 4 Mar 2019 15:00:48 -0500 Received: from mout.kundenserver.de ([212.227.17.13]:37263 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726038AbfCDUAs (ORCPT ); Mon, 4 Mar 2019 15:00:48 -0500 Received: from wuerfel.lan ([109.192.41.194]) by mrelayeu.kundenserver.de (mreue108 [212.227.15.145]) with ESMTPA (Nemesis) id 1M6UVr-1gu34r0Gef-006t1z; Mon, 04 Mar 2019 21:00:32 +0100 From: Arnd Bergmann To: =?utf-8?b?SsOpcsO0bWUgR2xpc3Nl?= Cc: Arnd Bergmann , Andrew Morton , Ralph Campbell , Stephen Rothwell , John Hubbard , Dan Williams , linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: [PATCH] mm/hmm: fix unused variable warnings Date: Mon, 4 Mar 2019 21:00:10 +0100 Message-Id: <20190304200026.1140281-1-arnd@arndb.de> X-Mailer: git-send-email 2.20.0 MIME-Version: 1.0 X-Provags-ID: V03:K1:oWsSM4Y3uyql69Hm+fLCuZ/Z86r27PiGHo7NAGMIgk4M3l90Nmy ydt8NvS6JaKV9VYNJVXLvscG9GMvo8XEdiR6O3sbiNSD7GDDpU1tE+T8tlNO8zQbwDD+k8E frU6qfqluZQZsGnwrwDOxAonBEvSxyVOmY9fmDQpIhagAGKEhh7UwYeUUNj89pMMdI1vMmz cLJYkuRg8vUOAfTEjf+Bw== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1; V03:K0:LbCpmeYVQ1U=:XVRFS0l/dUFasWwUJgPIv1 ToRudy+Iv+x7SApootlGef3ekqNy0FBxNQSrUS1m6HtV3vIVDE0SbbhpiTagwLoHowEOHWP/m pVsKzk9glXiv1wz8HBLU4ZIlonYcgQVnj5t+r/UYnxvG7BzVx7BLPSiEnq2UtCoxSgKm+9qNv VnuIIEZa6CV0WcjB2rJt3spS0GGwNYzY6CVvGKcDDS60UijVm9H1wWFUODOTAg/bdXp69StXl UvSk71BoH2XAVeQnHrZr5PL+hgOnmgjiZe/uuhasbIShcQwCObHpfOMDy3eSzmF8gWJMzH8Yo C5gRjXpqguAj/FJlY3J2OxCdYCZ660/Zp6fwaQkIQH5HumHTfM370DD3QbmszKGsWgJizbRTR ue9xQ+RiNntu+g+b8M07hhiZlGzH5XIkX4GOvHofQ9F4RauryZW4E4STvAoiAjpomwZSihthp 5BbMWf34FGrKLMxAoidOLEVcRHkAqXHShXSZgOxGE5zd9Bjjx6IYXNuPU0dVqPSRTeYsfAx1j IMNEkTyMStC/EjzZrwCAOaWTf1cRT310OcHuj54g5YWs4SluXcRpjkXSrdljhWXKZsngfVHOX cfZVguTufmuAci5UNUwE2yFHGqSgulN2amAO2G1Jpjjn+xbvqspz9nQo1JDGlo9OjJNGyJqPR agdR/bQiwx1bTK6np7azeryTDA/FLrKJDmFlfvkkOgbSGFVnXyFO9dyV8e+/1BiA/lFPPddLZ 4a91sSb12qpjgIIN5rgqj85y93y31rlswfP48w== Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. Fixes: 5409a90d4212 ("mm/hmm: support hugetlbfs (snapshotting, faulting and DMA mapping)") Signed-off-by: Arnd Bergmann --- mm/hmm.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) -- 2.20.0 diff --git a/mm/hmm.c b/mm/hmm.c index 3c9781037918..c4beb1628cad 100644 --- a/mm/hmm.c +++ b/mm/hmm.c @@ -1012,9 +1012,8 @@ long hmm_range_snapshot(struct hmm_range *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 *range, bool block) 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 {