Modifying sg_dma_len(sg)?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Several drivers reuse mapped scatterlists, and modify sg_dma_len(sg) to
match the actual number of bytes they want to transfer.

Hence during driver shutdown, dma_unmap_sg() is called with a scatterlist
that has modified lengths, compared to the original passed to dma_map_sg().
If CONFIG_DMA_API_DEBUG=y, this causes warnings like:

    WARNING: CPU: 0 PID: 20 at lib/dma-debug.c:1103 check_unmap+0x24c/0x85c()
    rcar-dmac e6700000.dma-controller: DMA-API: device driver frees
DMA memory with different size [device address=0x000000006e15f000]
[map size=4096 bytes] [unmap size=3 bytes]

The warning can be silenced by restoring the original sg_dma_len() just before
calling dma_unmap_sg(), but it looks like no driver actually does that.

Is it allowed to modify sg_dma_len(sg)?
Is it OK to restore the original sg_dma_len()?

Thanks for your answers!

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@xxxxxxxxxxxxxx

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds
--
To unsubscribe from this list: send the line "unsubscribe dmaengine" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Kernel]     [Linux ARM (vger)]     [Linux ARM MSM]     [Linux Omap]     [Linux Arm]     [Linux Tegra]     [Fedora ARM]     [Linux for Samsung SOC]     [eCos]     [Linux PCI]     [Linux Fastboot]     [Gcc Help]     [Git]     [DCCP]     [IETF Announce]     [Security]     [Linux MIPS]     [Yosemite Campsites]

  Powered by Linux