Skip to contentSkip to conversation

nios2: fix syscall_get_error()

PATCH New Dmitry V. Levin 1 participant 1 message Dec 3, 2018 NIOS2 architecture

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 nios2: fix syscall_get_error()

According to documentation in include/asm-generic/syscall.h, syscall_get_error() should return -ERRORCODE if the system call failed.

This change fixes syscall_get_error() implementation on nios2 to match its own syscall_set_return_value(), the documentation, and other architectures where syscall_get_error() returns a non-positive value.

Fixes 1000197d80132 ("nios2: System calls handling")
Cc [email protected] # v3.19+
---
 arch/nios2/include/asm/syscall.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/nios2/include/asm/syscall.h +1 -1
index 9de220854c4a..abf54addb804 100644
@@ -35,7 +35,7 @@ static inline void syscall_rollback(struct task_struct *task,
 static inline long syscall_get_error(struct task_struct *task,
 				struct pt_regs *regs)
 {
-	return regs->r7 ? regs->r2 : 0;
+	return regs->r7 ? -regs->r2 : 0;
 }
 
 static inline long syscall_get_return_value(struct task_struct *task,
Signature · 1 line
ldv