Skip to contentSkip to conversation

arch/riscv/kernel: remove redundant err variable

PATCH In review [email protected] 2 participants 2 messages Jan 12, 2022 – Jan 20, 2022

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 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.

---
 arch/riscv/kernel/ptrace.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
arch/riscv/kernel/ptrace.c +1 -3
index 9c0511119bad..a89243730153 100644
@@ -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
Signature · 1 line
2.25.1
maintainer
#1 lore raw
Quoted 20 lines · 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.

---
 arch/riscv/kernel/ptrace.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
arch/riscv/kernel/ptrace.c +0 -0
index 9c0511119bad..a89243730153 100644
@@ -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)
 {

arch/riscv/kernel/ptrace.c static int riscv_gpr_set(struct task_struct *target, · line 51

Quoted 10 lines
arch/riscv/kernel/ptrace.c +1 -3
-	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.