mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Dmitry V. Levin" <ldv@altlinux.org>
To: Michal Simek <monstr@monstr.eu>
Cc: Elvira Khabirova <lineprinter@altlinux.org>,
	Eugene Syromyatnikov <esyr@redhat.com>,
	linux-kernel@vger.kernel.org
Subject: [PATCH] microblaze: fix syscall_set_return_value()
Date: Mon, 3 Dec 2018 06:17:33 +0300	[thread overview]
Message-ID: <20181203031733.GB11573@altlinux.org> (raw)

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

                 reply	other threads:[~2018-12-03  3:17 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20181203031733.GB11573@altlinux.org \
    --to=ldv@altlinux.org \
    --cc=esyr@redhat.com \
    --cc=lineprinter@altlinux.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=monstr@monstr.eu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®