From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Subject: [PATCH 4/5] s390/pci: Move an assignment for the variable "ret" in s390_pci_mmio_write() References: From: SF Markus Elfring Message-ID: Date: Sat, 21 Jan 2017 19:13:33 +0100 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-Archive: List-Post: To: linux-s390@vger.kernel.org, =?UTF-8?Q?Gerald_Sch=c3=a4fer?= , Heiko Carstens , Martin Schwidefsky , Sebastian Ott Cc: LKML , kernel-janitors@vger.kernel.org List-ID: From: Markus Elfring 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 --- 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