From: Qian Cai <cai@lca.pw>
To: benh@kernel.crashing.org, paulus@samba.org, mpe@ellerman.id.au
Cc: aik@ozlabs.ru, linuxppc-dev@lists.ozlabs.org,
linux-kernel@vger.kernel.org, Qian Cai <cai@lca.pw>
Subject: [PATCH] powerpc/powernv: fix variable "c" set but not used
Date: Wed, 22 May 2019 22:31:41 -0400 [thread overview]
Message-ID: <20190523023141.2973-1-cai@lca.pw> (raw)
The commit 58629c0dc349 ("powerpc/powernv/npu: Fault user page into the
hypervisor's pagetable") introduced a variable "c" to be used in
__get_user() and __get_user_nocheck() which need to stay as macros for
performance reasons, and "c" is not actually used in
pnv_npu2_handle_fault(),
arch/powerpc/platforms/powernv/npu-dma.c: In function 'pnv_npu2_handle_fault':
arch/powerpc/platforms/powernv/npu-dma.c:1122:7: warning: variable 'c'
set but not used [-Wunused-but-set-variable]
Fixed it by appending the __maybe_unused attribute, so compilers would
ignore it.
Signed-off-by: Qian Cai <cai@lca.pw>
---
arch/powerpc/platforms/powernv/npu-dma.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/arch/powerpc/platforms/powernv/npu-dma.c b/arch/powerpc/platforms/powernv/npu-dma.c
index 495550432f3d..5bbe59573ee6 100644
--- a/arch/powerpc/platforms/powernv/npu-dma.c
+++ b/arch/powerpc/platforms/powernv/npu-dma.c
@@ -1119,7 +1119,8 @@ int pnv_npu2_handle_fault(struct npu_context *context, uintptr_t *ea,
int i, is_write;
struct page *page[1];
const char __user *u;
- char c;
+ /* To silence a -Wunused-but-set-variable warning. */
+ char c __maybe_unused;
/* mmap_sem should be held so the struct_mm must be present */
struct mm_struct *mm = context->mm;
--
2.20.1 (Apple Git-117)
next reply other threads:[~2019-05-23 2:32 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-05-23 2:31 Qian Cai [this message]
2019-05-23 7:26 ` [PATCH] powerpc/powernv: fix variable "c" set but not used Christophe Leroy
2019-05-23 7:46 ` Christoph Hellwig
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190523023141.2973-1-cai@lca.pw \
--to=cai@lca.pw \
--cc=aik@ozlabs.ru \
--cc=benh@kernel.crashing.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=mpe@ellerman.id.au \
--cc=paulus@samba.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox