lkml.org 
[lkml]   [2009]   [May]   [18]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    From
    SubjectRe: [PATCH] asm-generic: add a dma-mapping.h file
    Date
    On Monday 18 May 2009, Geert Uytterhoeven wrote:

    > > +#ifndef dma_alloc_coherent
    > > +static inline void *
    > > +dma_alloc_coherent(struct device *dev, size_t size, dma_addr_t *dma_handle,
    > > +                  gfp_t flag)
    > > +{
    > > +       void *virt = kmalloc(size, flag);
    >
    > kmalloc() may fail.
    >
    > > +       *dma_handle = virt_to_phys(virt);
    >
    > Not all variants of virt_to_phys() may handle the NULL case very well.
    > I took a statistically invalid sample: some just cast to unsigned
    > long, other subtract PAGE_OFFSET.

    Right. It should not really hurt, because all users need to check virt
    before using dma_handle, but I can fix it just to be sure.

    I'll wait for comments from Fujita Tomonori and others before I repost.

    Arnd <><
    --
    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to majordomo@vger.kernel.org
    More majordomo info at http://vger.kernel.org/majordomo-info.html
    Please read the FAQ at http://www.tux.org/lkml/

    \
     
     \ /
      Last update: 2009-05-18 10:33    [W:0.028 / U:32.072 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site