All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Liam R. Howlett" <Liam.Howlett@Oracle.com>
To: sparclinux@vger.kernel.org
Subject: [PATCH] sparc: Clean up pci mmap function.
Date: Wed, 21 Dec 2016 18:57:04 +0000	[thread overview]
Message-ID: <1482346624-14378-1-git-send-email-Liam.Howlett@Oracle.com> (raw)

Simplify logic for call to __pci_mmap_make_offset which only returns
-EINVAL or zero and remove unnecessary if statement & variable from
pci_mmap_page_range.

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
---
 arch/sparc/kernel/pci.c | 12 +++---------
 1 file changed, 3 insertions(+), 9 deletions(-)

diff --git a/arch/sparc/kernel/pci.c b/arch/sparc/kernel/pci.c
index 208d7c0..e021ae0 100644
--- a/arch/sparc/kernel/pci.c
+++ b/arch/sparc/kernel/pci.c
@@ -905,11 +905,9 @@ int pci_mmap_page_range(struct pci_dev *dev, struct vm_area_struct *vma,
 			enum pci_mmap_state mmap_state,
 			int write_combine)
 {
-	int ret;
 
-	ret = __pci_mmap_make_offset(dev, vma, mmap_state);
-	if (ret < 0)
-		return ret;
+	if (__pci_mmap_make_offset(dev, vma, mmap_state))
+		return -EINVAL;
 
 	if (__pci_mmap_page_invalid(dev, vma->vm_pgoff))
 		return -EINVAL;
@@ -917,14 +915,10 @@ int pci_mmap_page_range(struct pci_dev *dev, struct vm_area_struct *vma,
 	__pci_mmap_set_pgprot(dev, vma, mmap_state);
 
 	vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot);
-	ret = io_remap_pfn_range(vma, vma->vm_start,
+	return io_remap_pfn_range(vma, vma->vm_start,
 				 vma->vm_pgoff,
 				 vma->vm_end - vma->vm_start,
 				 vma->vm_page_prot);
-	if (ret)
-		return ret;
-
-	return 0;
 }
 
 #ifdef CONFIG_NUMA
-- 
2.1.4


             reply	other threads:[~2016-12-21 18:57 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-12-21 18:57 Liam R. Howlett [this message]
2016-12-21 19:14 ` [PATCH] sparc: Clean up pci mmap function David Miller

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=1482346624-14378-1-git-send-email-Liam.Howlett@Oracle.com \
    --to=liam.howlett@oracle.com \
    --cc=sparclinux@vger.kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.