Fix the following coccicheck warning:
./arch/microblaze/kernel/signal.c:60:14-17: Unneeded variable: "err".
Return "0" on line 78
Reported-by: Abaci Robot <[email protected]>
Signed-off-by: Yang Li <[email protected]>
---
arch/microblaze/kernel/signal.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/arch/microblaze/kernel/signal.c b/arch/microblaze/kernel/signal.c
index fc61eb0..c4b7b30 100644
--- a/arch/microblaze/kernel/signal.c
+++ b/arch/microblaze/kernel/signal.c
@@ -57,8 +57,6 @@ struct rt_sigframe {
static int restore_sigcontext(struct pt_regs *regs,
struct sigcontext __user *sc, int *rval_p)
{
- unsigned int err = 0;
-
#define COPY(x) {err |= __get_user(regs->x, &sc->regs.x); }
COPY(r0);
COPY(r1);
@@ -75,7 +73,7 @@ static int restore_sigcontext(struct pt_regs *regs,
*rval_p = regs->r3;
- return err;
+ return 0;
}
asmlinkage long sys_rt_sigreturn(struct pt_regs *regs)
--
1.8.3.1
On 3/10/21 9:50 AM, Yang Li wrote:
> Fix the following coccicheck warning:
> ./arch/microblaze/kernel/signal.c:60:14-17: Unneeded variable: "err".
> Return "0" on line 78
>
> Reported-by: Abaci Robot <[email protected]>
> Signed-off-by: Yang Li <[email protected]>
> ---
> arch/microblaze/kernel/signal.c | 4 +---
> 1 file changed, 1 insertion(+), 3 deletions(-)
>
> diff --git a/arch/microblaze/kernel/signal.c b/arch/microblaze/kernel/signal.c
> index fc61eb0..c4b7b30 100644
> --- a/arch/microblaze/kernel/signal.c
> +++ b/arch/microblaze/kernel/signal.c
> @@ -57,8 +57,6 @@ struct rt_sigframe {
> static int restore_sigcontext(struct pt_regs *regs,
> struct sigcontext __user *sc, int *rval_p)
> {
> - unsigned int err = 0;
> -
> #define COPY(x) {err |= __get_user(regs->x, &sc->regs.x); }
This is wrong because as you use err is used here.
Thanks,
Michal
> COPY(r0);
> COPY(r1);
> @@ -75,7 +73,7 @@ static int restore_sigcontext(struct pt_regs *regs,
>
> *rval_p = regs->r3;
>
> - return err;
> + return 0;
> }
>
> asmlinkage long sys_rt_sigreturn(struct pt_regs *regs)
>
--
Michal Simek, Ing. (M.Eng), OpenPGP -> KeyID: FE3D1F91
w: http://www.monstr.eu p: +42-0-721842854
Maintainer of Linux kernel - Xilinx Microblaze
Maintainer of Linux kernel - Xilinx Zynq ARM and ZynqMP ARM64 SoCs
U-Boot custodian - Xilinx Microblaze/Zynq/ZynqMP/Versal SoCs
Hi Yang,
Thank you for the patch! Yet something to improve:
[auto build test ERROR on linux/master]
[also build test ERROR on linus/master v5.12-rc2 next-20210310]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]
url: https://github.com/0day-ci/linux/commits/Yang-Li/microblaze-remove-unneeded-variable-err/20210310-165230
base: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 144c79ef33536b4ecb4951e07dbc1f2b7fa99d32
config: microblaze-randconfig-r006-20210309 (attached as .config)
compiler: microblaze-linux-gcc (GCC) 9.3.0
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# https://github.com/0day-ci/linux/commit/3e5cd1e0be818f4bfaafd1c6fed6775d27816f40
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Yang-Li/microblaze-remove-unneeded-variable-err/20210310-165230
git checkout 3e5cd1e0be818f4bfaafd1c6fed6775d27816f40
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=microblaze
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <[email protected]>
All errors (new ones prefixed by >>):
arch/microblaze/kernel/signal.c: In function 'restore_sigcontext':
>> arch/microblaze/kernel/signal.c:60:19: error: 'err' undeclared (first use in this function)
60 | #define COPY(x) {err |= __get_user(regs->x, &sc->regs.x); }
| ^~~
arch/microblaze/kernel/signal.c:61:2: note: in expansion of macro 'COPY'
61 | COPY(r0);
| ^~~~
arch/microblaze/kernel/signal.c:60:19: note: each undeclared identifier is reported only once for each function it appears in
60 | #define COPY(x) {err |= __get_user(regs->x, &sc->regs.x); }
| ^~~
arch/microblaze/kernel/signal.c:61:2: note: in expansion of macro 'COPY'
61 | COPY(r0);
| ^~~~
vim +/err +60 arch/microblaze/kernel/signal.c
2148daa9c45ff4 Michal Simek 2009-03-27 56
353b431bafc42e Arnd Bergmann 2009-05-01 57 static int restore_sigcontext(struct pt_regs *regs,
353b431bafc42e Arnd Bergmann 2009-05-01 58 struct sigcontext __user *sc, int *rval_p)
2148daa9c45ff4 Michal Simek 2009-03-27 59 {
2148daa9c45ff4 Michal Simek 2009-03-27 @60 #define COPY(x) {err |= __get_user(regs->x, &sc->regs.x); }
2148daa9c45ff4 Michal Simek 2009-03-27 61 COPY(r0);
2148daa9c45ff4 Michal Simek 2009-03-27 62 COPY(r1);
2148daa9c45ff4 Michal Simek 2009-03-27 63 COPY(r2); COPY(r3); COPY(r4); COPY(r5);
2148daa9c45ff4 Michal Simek 2009-03-27 64 COPY(r6); COPY(r7); COPY(r8); COPY(r9);
2148daa9c45ff4 Michal Simek 2009-03-27 65 COPY(r10); COPY(r11); COPY(r12); COPY(r13);
2148daa9c45ff4 Michal Simek 2009-03-27 66 COPY(r14); COPY(r15); COPY(r16); COPY(r17);
2148daa9c45ff4 Michal Simek 2009-03-27 67 COPY(r18); COPY(r19); COPY(r20); COPY(r21);
2148daa9c45ff4 Michal Simek 2009-03-27 68 COPY(r22); COPY(r23); COPY(r24); COPY(r25);
2148daa9c45ff4 Michal Simek 2009-03-27 69 COPY(r26); COPY(r27); COPY(r28); COPY(r29);
2148daa9c45ff4 Michal Simek 2009-03-27 70 COPY(r30); COPY(r31);
2148daa9c45ff4 Michal Simek 2009-03-27 71 COPY(pc); COPY(ear); COPY(esr); COPY(fsr);
2148daa9c45ff4 Michal Simek 2009-03-27 72 #undef COPY
2148daa9c45ff4 Michal Simek 2009-03-27 73
2148daa9c45ff4 Michal Simek 2009-03-27 74 *rval_p = regs->r3;
2148daa9c45ff4 Michal Simek 2009-03-27 75
3e5cd1e0be818f Yang Li 2021-03-10 76 return 0;
2148daa9c45ff4 Michal Simek 2009-03-27 77 }
2148daa9c45ff4 Michal Simek 2009-03-27 78
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/[email protected]