lkml.org 
[lkml]   [2007]   [Dec]   [15]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    Date
    From
    SubjectRe: [patch 06/18] ieee1394: nopage
    On  6 Dec, Nick Piggin wrote:
    > On Wed, Dec 05, 2007 at 02:09:48PM +0100, Stefan Richter wrote:
    >> npiggin@suse.de 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 <stefanr@s5r6.in-berlin.de>
    ---
    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/


    \
     
     \ /
      Last update: 2007-12-15 14:07    [W:0.022 / U:34.816 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site