public inbox for linux-s390@vger.kernel.org
 help / color / mirror / Atom feed
From: SF Markus Elfring <elfring@users.sourceforge.net>
To: linux-s390@vger.kernel.org,
	"Gerald Schäfer" <gerald.schaefer@de.ibm.com>,
	"Heiko Carstens" <heiko.carstens@de.ibm.com>,
	"Martin Schwidefsky" <schwidefsky@de.ibm.com>,
	"Sebastian Ott" <sebott@linux.vnet.ibm.com>
Cc: LKML <linux-kernel@vger.kernel.org>, kernel-janitors@vger.kernel.org
Subject: [PATCH 4/5] s390/pci: Move an assignment for the variable "ret" in s390_pci_mmio_write()
Date: Sat, 21 Jan 2017 19:13:33 +0100	[thread overview]
Message-ID: <ba783658-2c08-8e92-7f6a-16696c89b476@users.sourceforge.net> (raw)
In-Reply-To: <f2233afd-bc54-0697-0709-9577e96fc6a6@users.sourceforge.net>

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Sat, 21 Jan 2017 18:35:00 +0100

A local variable was set to an error code before a concrete error situation
was detected. Thus move the corresponding assignment into an if branch
to indicate a software failure there.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 arch/s390/pci/pci_mmio.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/arch/s390/pci/pci_mmio.c b/arch/s390/pci/pci_mmio.c
index b1bb2b72302c..f125858a77e9 100644
--- a/arch/s390/pci/pci_mmio.c
+++ b/arch/s390/pci/pci_mmio.c
@@ -57,12 +57,11 @@ SYSCALL_DEFINE3(s390_pci_mmio_write, unsigned long, mmio_addr,
 		goto out;
 	io_addr = (void __iomem *)((pfn << PAGE_SHIFT) | (mmio_addr & ~PAGE_MASK));
 
-	ret = -EFAULT;
-	if ((unsigned long) io_addr < ZPCI_IOMAP_ADDR_BASE)
-		goto out;
-
-	if (copy_from_user(buf, user_buffer, length))
+	if ((unsigned long)io_addr < ZPCI_IOMAP_ADDR_BASE ||
+	    copy_from_user(buf, user_buffer, length)) {
+		ret = -EFAULT;
 		goto out;
+	}
 
 	ret = zpci_memcpy_toio(io_addr, buf, length);
 out:
-- 
2.11.0

  parent reply	other threads:[~2017-01-21 18:13 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-01-21 18:09 [PATCH 0/5] s390/pci: Fine-tuning for three function implementations SF Markus Elfring
2017-01-21 18:10 ` [PATCH 1/5] s390/pci: Return directly after a failed parameter validation in clp_normal_command() SF Markus Elfring
2017-01-21 18:11 ` [PATCH 2/5] s390/pci: Return directly after a failed clp_alloc_block() " SF Markus Elfring
2017-01-21 18:12 ` [PATCH 3/5] s390/pci: Move three assignments for the variable "rc" " SF Markus Elfring
2017-01-21 19:20   ` kbuild test robot
2017-01-21 18:13 ` SF Markus Elfring [this message]
2017-01-23  8:58   ` [PATCH 4/5] s390/pci: Move an assignment for the variable "ret" in s390_pci_mmio_write() Dan Carpenter
2017-01-21 18:14 ` [PATCH 5/5] s390/pci: Move two assignments for the variable "ret" in get_pfn() SF Markus Elfring
2017-01-23  8:55 ` [PATCH 0/5] s390/pci: Fine-tuning for three function implementations Dan Carpenter

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=ba783658-2c08-8e92-7f6a-16696c89b476@users.sourceforge.net \
    --to=elfring@users.sourceforge.net \
    --cc=gerald.schaefer@de.ibm.com \
    --cc=heiko.carstens@de.ibm.com \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-s390@vger.kernel.org \
    --cc=schwidefsky@de.ibm.com \
    --cc=sebott@linux.vnet.ibm.com \
    /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