* [PATCH] sparc: Clean up pci mmap function.
@ 2016-12-21 18:57 Liam R. Howlett
2016-12-21 19:14 ` David Miller
0 siblings, 1 reply; 2+ messages in thread
From: Liam R. Howlett @ 2016-12-21 18:57 UTC (permalink / raw)
To: sparclinux
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
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] sparc: Clean up pci mmap function.
2016-12-21 18:57 [PATCH] sparc: Clean up pci mmap function Liam R. Howlett
@ 2016-12-21 19:14 ` David Miller
0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2016-12-21 19:14 UTC (permalink / raw)
To: sparclinux
From: "Liam R. Howlett" <Liam.Howlett@Oracle.com>
Date: Wed, 21 Dec 2016 13:57:04 -0500
> 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>
This is not a legitimate simplification. Maybe it only returns
-EINVAL as an error code now, but the whole point of returning an
explicit error code is so that in the future it can transparently be
changed to return different ones and the callers will not need
any changes.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2016-12-21 19:14 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-12-21 18:57 [PATCH] sparc: Clean up pci mmap function Liam R. Howlett
2016-12-21 19:14 ` David Miller
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.