[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20190523023141.2973-1-cai@lca.pw>
Date: Wed, 22 May 2019 22:31:41 -0400
From: Qian Cai <cai@....pw>
To: benh@...nel.crashing.org, paulus@...ba.org, mpe@...erman.id.au
Cc: aik@...abs.ru, linuxppc-dev@...ts.ozlabs.org,
linux-kernel@...r.kernel.org, Qian Cai <cai@....pw>
Subject: [PATCH] powerpc/powernv: fix variable "c" set but not used
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@....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)
Powered by blists - more mailing lists