On 6 Dec, Nick Piggin wrote:
> On Wed, Dec 05, 2007 at 02:09:48PM +0100, Stefan Richter wrote:
>> [email protected] wrote:
>> > + if (vmf->pgoff >= dma->n_pages)
>> > + goto error;
>> > +
>> > + kernel_virt_addr = (unsigned long)dma->kvirt + (vmf->pgoff << PAGE_SHIFT);
>> > + vmf->page = vmalloc_to_page((void *)kernel_virt_addr);
>> > + get_page(vmf->page);
>> > + return 0;
>> > +
>> > + error:
>> > + return VM_FAULT_SIGBUS;
>> > }
>>
>> Why not replacing the two 'goto error' by 'return VM_FAULT_SIGBUS'? If
>> there is no cleanup after that error jump, I find it sensible to return
>> early.
>
> Fair enough, I just didn't want to gamut of reactions from maintainers
> to my cleanups ;)
Subject: ieee1394: small cleanup after "nopage"
Signed-off-by: Stefan Richter <[email protected]>
---
drivers/ieee1394/dma.c | 16 ++++------------
1 file changed, 4 insertions(+), 12 deletions(-)
Index: linux/drivers/ieee1394/dma.c
===================================================================
--- linux.orig/drivers/ieee1394/dma.c
+++ linux/drivers/ieee1394/dma.c
@@ -231,28 +231,20 @@ void dma_region_sync_for_device(struct d
#ifdef CONFIG_MMU
-/* fault() handler for mmap access */
-
static int dma_region_pagefault(struct vm_area_struct *vma,
- struct vm_fault *vmf)
+ struct vm_fault *vmf)
{
- unsigned long kernel_virt_addr;
-
struct dma_region *dma = (struct dma_region *)vma->vm_private_data;
if (!dma->kvirt)
- goto error;
+ return VM_FAULT_SIGBUS;
if (vmf->pgoff >= dma->n_pages)
- goto error;
+ return VM_FAULT_SIGBUS;
- kernel_virt_addr = (unsigned long)dma->kvirt + (vmf->pgoff << PAGE_SHIFT);
- vmf->page = vmalloc_to_page((void *)kernel_virt_addr);
+ vmf->page = vmalloc_to_page(dma->kvirt + (vmf->pgoff << PAGE_SHIFT));
get_page(vmf->page);
return 0;
-
- error:
- return VM_FAULT_SIGBUS;
}
static struct vm_operations_struct dma_region_vm_ops = {
--
Stefan Richter
-=====-=-=== ==-- -====
http://arcgraph.de/sr/
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[Index of Archives]
[Kernel Newbies]
[Netfilter]
[Bugtraq]
[Photo]
[Stuff]
[Gimp]
[Yosemite News]
[MIPS Linux]
[ARM Linux]
[Linux Security]
[Linux RAID]
[Video 4 Linux]
[Linux for the blind]
[Linux Resources]