Message ID | 20180225172236.29650-5-malat@debian.org (mailing list archive) |
---|---|
State | Accepted |
Commit | 67b464a89c21c9edd45ad15c457bb5f25dadecfd |
Headers | show |
Series | powerpc/gamecube: make W=1 compilation errors free | expand |
On Sun, 2018-02-25 at 17:22:19 UTC, Mathieu Malaterre wrote: > Since the value of `tmp` is never intended to be read, declare both `tmp` > variables as unused. Fix warning (treated as error in W=1): > > CC arch/powerpc/kernel/signal_32.o > arch/powerpc/kernel/signal_32.c: In function ‘sys_swapcontext’: > arch/powerpc/kernel/signal_32.c:1048:16: error: variable ‘tmp’ set but not used [-Werror=unused-but-set-variable] > unsigned char tmp; > ^~~ > arch/powerpc/kernel/signal_32.c: In function ‘sys_debug_setcontext’: > arch/powerpc/kernel/signal_32.c:1234:16: error: variable ‘tmp’ set but not used [-Werror=unused-but-set-variable] > unsigned char tmp; > ^~~ > cc1: all warnings being treated as errors > > Signed-off-by: Mathieu Malaterre <malat@debian.org> Applied to powerpc next, thanks. https://git.kernel.org/powerpc/c/67b464a89c21c9edd45ad15c457bb5 cheers
Le 25/02/2018 à 18:22, Mathieu Malaterre a écrit : > Since the value of `tmp` is never intended to be read, declare both `tmp` > variables as unused. Fix warning (treated as error in W=1): What about using fault_in_pages_readable() instead ? Christophe > > CC arch/powerpc/kernel/signal_32.o > arch/powerpc/kernel/signal_32.c: In function ‘sys_swapcontext’: > arch/powerpc/kernel/signal_32.c:1048:16: error: variable ‘tmp’ set but not used [-Werror=unused-but-set-variable] > unsigned char tmp; > ^~~ > arch/powerpc/kernel/signal_32.c: In function ‘sys_debug_setcontext’: > arch/powerpc/kernel/signal_32.c:1234:16: error: variable ‘tmp’ set but not used [-Werror=unused-but-set-variable] > unsigned char tmp; > ^~~ > cc1: all warnings being treated as errors > > Signed-off-by: Mathieu Malaterre <malat@debian.org> > --- > arch/powerpc/kernel/signal_32.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/arch/powerpc/kernel/signal_32.c b/arch/powerpc/kernel/signal_32.c > index a46de0035214..492f03451877 100644 > --- a/arch/powerpc/kernel/signal_32.c > +++ b/arch/powerpc/kernel/signal_32.c > @@ -1045,7 +1045,7 @@ long sys_swapcontext(struct ucontext __user *old_ctx, > struct ucontext __user *new_ctx, > int ctx_size, int r6, int r7, int r8, struct pt_regs *regs) > { > - unsigned char tmp; > + unsigned char tmp __maybe_unused; > int ctx_has_vsx_region = 0; > > #ifdef CONFIG_PPC64 > @@ -1231,7 +1231,7 @@ int sys_debug_setcontext(struct ucontext __user *ctx, > { > struct sig_dbg_op op; > int i; > - unsigned char tmp; > + unsigned char tmp __maybe_unused; > unsigned long new_msr = regs->msr; > #ifdef CONFIG_PPC_ADV_DEBUG_REGS > unsigned long new_dbcr0 = current->thread.debug.dbcr0; >
Christophe LEROY <christophe.leroy@c-s.fr> writes: > Le 25/02/2018 à 18:22, Mathieu Malaterre a écrit : >> Since the value of `tmp` is never intended to be read, declare both `tmp` >> variables as unused. Fix warning (treated as error in W=1): > > What about using fault_in_pages_readable() instead ? Yeah that looks like it would work. I'd be happy to take a tested patch :D cheers
diff --git a/arch/powerpc/kernel/signal_32.c b/arch/powerpc/kernel/signal_32.c index a46de0035214..492f03451877 100644 --- a/arch/powerpc/kernel/signal_32.c +++ b/arch/powerpc/kernel/signal_32.c @@ -1045,7 +1045,7 @@ long sys_swapcontext(struct ucontext __user *old_ctx, struct ucontext __user *new_ctx, int ctx_size, int r6, int r7, int r8, struct pt_regs *regs) { - unsigned char tmp; + unsigned char tmp __maybe_unused; int ctx_has_vsx_region = 0; #ifdef CONFIG_PPC64 @@ -1231,7 +1231,7 @@ int sys_debug_setcontext(struct ucontext __user *ctx, { struct sig_dbg_op op; int i; - unsigned char tmp; + unsigned char tmp __maybe_unused; unsigned long new_msr = regs->msr; #ifdef CONFIG_PPC_ADV_DEBUG_REGS unsigned long new_dbcr0 = current->thread.debug.dbcr0;
Since the value of `tmp` is never intended to be read, declare both `tmp` variables as unused. Fix warning (treated as error in W=1): CC arch/powerpc/kernel/signal_32.o arch/powerpc/kernel/signal_32.c: In function ‘sys_swapcontext’: arch/powerpc/kernel/signal_32.c:1048:16: error: variable ‘tmp’ set but not used [-Werror=unused-but-set-variable] unsigned char tmp; ^~~ arch/powerpc/kernel/signal_32.c: In function ‘sys_debug_setcontext’: arch/powerpc/kernel/signal_32.c:1234:16: error: variable ‘tmp’ set but not used [-Werror=unused-but-set-variable] unsigned char tmp; ^~~ cc1: all warnings being treated as errors Signed-off-by: Mathieu Malaterre <malat@debian.org> --- arch/powerpc/kernel/signal_32.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)