Re: [PATCH v3 2/4] of: move of_dma_configure() to device,c to help re-use
From: Rob Herring
Date: Wed Jan 07 2015 - 18:38:23 EST
On Wed, Jan 7, 2015 at 12:49 PM, Murali Karicheri <m-karicheri2@xxxxxx> wrote:
> Move of_dma_configure() to device.c so that same function can be re-used
> for PCI devices to obtain DMA configuration from DT. Also add a second
> argument so that for PCI, DT node of root bus host bridge can be used to
> obtain the DMA configuration for the slave PCI device. Additionally fix
> the dma-range size when the DT attribute is missing. i.e set size to
> dev->coherent_dma_mask + 1 instead of dev->coherent_dma_mask.
Additionally is a red flag for put in another patch. There is an issue
I think as well.
> + ret = of_dma_get_range(np, &dma_addr, &paddr, &size);
> + if (ret < 0) {
> + dma_addr = offset = 0;
> + size = dev->coherent_dma_mask + 1;
If coherent_dma_mask is DMA_BIT_MASK(64), then you will overflow and
have a size of 0. There may also be a problem when the mask is only
32-bit type.
Rob
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/