2022-01-12 08:27:39

by CGEL

[permalink] [raw]
Subject: [PATCH] arch/riscv/kernel: remove redundant err variable

From: Minghao Chi <[email protected]>

Return value from user_regset_copyin() directly instead
of taking this in another redundant variable.

Reported-by: Zeal Robot <[email protected]>
Signed-off-by: Minghao Chi <[email protected]>
Signed-off-by: CGEL ZTE <[email protected]>
---
arch/riscv/kernel/ptrace.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/arch/riscv/kernel/ptrace.c b/arch/riscv/kernel/ptrace.c
index 9c0511119bad..a89243730153 100644
--- a/arch/riscv/kernel/ptrace.c
+++ b/arch/riscv/kernel/ptrace.c
@@ -42,12 +42,10 @@ static int riscv_gpr_set(struct task_struct *target,
unsigned int pos, unsigned int count,
const void *kbuf, const void __user *ubuf)
{
- int ret;
struct pt_regs *regs;

regs = task_pt_regs(target);
- ret = user_regset_copyin(&pos, &count, &kbuf, &ubuf, regs, 0, -1);
- return ret;
+ return user_regset_copyin(&pos, &count, &kbuf, &ubuf, regs, 0, -1);
}

#ifdef CONFIG_FPU
--
2.25.1



2022-01-21 22:32:33

by Palmer Dabbelt

[permalink] [raw]
Subject: Re: [PATCH] arch/riscv/kernel: remove redundant err variable

On Wed, 12 Jan 2022 00:27:29 PST (-0800), [email protected] wrote:
> From: Minghao Chi <[email protected]>
>
> Return value from user_regset_copyin() directly instead
> of taking this in another redundant variable.
>
> Reported-by: Zeal Robot <[email protected]>
> Signed-off-by: Minghao Chi <[email protected]>
> Signed-off-by: CGEL ZTE <[email protected]>
> ---
> arch/riscv/kernel/ptrace.c | 4 +---
> 1 file changed, 1 insertion(+), 3 deletions(-)
>
> diff --git a/arch/riscv/kernel/ptrace.c b/arch/riscv/kernel/ptrace.c
> index 9c0511119bad..a89243730153 100644
> --- a/arch/riscv/kernel/ptrace.c
> +++ b/arch/riscv/kernel/ptrace.c
> @@ -42,12 +42,10 @@ static int riscv_gpr_set(struct task_struct *target,
> unsigned int pos, unsigned int count,
> const void *kbuf, const void __user *ubuf)
> {
> - int ret;
> struct pt_regs *regs;
>
> regs = task_pt_regs(target);
> - ret = user_regset_copyin(&pos, &count, &kbuf, &ubuf, regs, 0, -1);
> - return ret;
> + return user_regset_copyin(&pos, &count, &kbuf, &ubuf, regs, 0, -1);
> }
>
> #ifdef CONFIG_FPU

Thanks, this is on for-next.