linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] microblaze: fix syscall_set_return_value()
@ 2018-12-03  3:17 Dmitry V. Levin
  0 siblings, 0 replies; only message in thread
From: Dmitry V. Levin @ 2018-12-03  3:17 UTC (permalink / raw)
  To: Michal Simek; +Cc: Elvira Khabirova, Eugene Syromyatnikov, linux-kernel

According to documentation in include/asm-generic/syscall.h,
if error argument of syscall_set_return_value() is nonzero,
it is a negated errno.

This change fixes syscall_set_return_value() implementation on
microblaze to match its own syscall_get_error(), the documentation,
and other architectures where error argument of
syscall_set_return_value() is non-positive.

Fixes: d5b37092aae1e ("microblaze: Implement include/asm/syscall.h.")
Cc: stable@vger.kernel.org # v2.6.32+
Signed-off-by: Dmitry V. Levin <ldv@altlinux.org>
---
 arch/microblaze/include/asm/syscall.h | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/arch/microblaze/include/asm/syscall.h b/arch/microblaze/include/asm/syscall.h
index 220decd605a4..c2489a591d6b 100644
--- a/arch/microblaze/include/asm/syscall.h
+++ b/arch/microblaze/include/asm/syscall.h
@@ -36,10 +36,7 @@ static inline void syscall_set_return_value(struct task_struct *task,
 					    struct pt_regs *regs,
 					    int error, long val)
 {
-	if (error)
-		regs->r3 = -error;
-	else
-		regs->r3 = val;
+	regs->r3 = error ?: val;
 }
 
 static inline microblaze_reg_t microblaze_get_syscall_arg(struct pt_regs *regs,
-- 
ldv

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2018-12-03  3:17 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-12-03  3:17 [PATCH] microblaze: fix syscall_set_return_value() Dmitry V. Levin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).