sparc: Clean up pci mmap function.
PATCH 1/1 sparc: Clean up pci mmap function.
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 <[email protected]>
--- arch/sparc/kernel/pci.c | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-)
arch/sparc/kernel/pci.c +3 -9
@@ -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
Signature · 1 line
2.1.4
David Miller
maintainerFrom: "Liam R. Howlett" <[email protected]>
Date: Wed, 21 Dec 2016 13:57:04 -0500
Quoted 5 lines
Simplify logic for call to
__pci_mmap_make_offsetwhich only returns-EINVALor zero and remove unnecessary if statement & variable frompci_mmap_page_range.Signed-off-by Liam R. Howlett <[email protected]>
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.