Re: [PATCH] microblaze: remove unneeded variable 'err'

From: Michal Simek
Date: Wed Mar 10 2021 - 04:31:43 EST




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 <abaci@xxxxxxxxxxxxxxxxx>
> Signed-off-by: Yang Li <yang.lee@xxxxxxxxxxxxxxxxx>
> ---
> 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: 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