* [PATCH] arm: dma-mapping: fix build warning with new DMA_ERROR_CODE definition
@ 2015-09-14 16:13 Andre Przywara
2015-09-14 16:31 ` Russell King - ARM Linux
0 siblings, 1 reply; 2+ messages in thread
From: Andre Przywara @ 2015-09-14 16:13 UTC (permalink / raw)
To: linux
Cc: linux-arm-kernel, will.deacon, catalin.marinas, Marek Szyprowski,
linux-kernel
Commit 96231b2686b5: ("ARM: 8419/1: dma-mapping: harmonize definition
of DMA_ERROR_CODE") changed the definition of DMA_ERROR_CODE to use
dma_addr_t, which makes the compiler barf on assigning this to an
"int" variable on ARM with LPAE enabled:
-------------------
In file included from /src/linux/include/linux/dma-mapping.h:86:0,
from /src/linux/arch/arm/mm/dma-mapping.c:21:
/src/linux/arch/arm/mm/dma-mapping.c: In function '__iommu_create_mapping':
/src/linux/arch/arm/include/asm/dma-mapping.h:16:24: warning:
overflow in implicit constant conversion [-Woverflow]
#define DMA_ERROR_CODE (~(dma_addr_t)0x0)
^
/src/linux/arch/arm/mm/dma-mapping.c:1252:15: note: in expansion of
macro DMA_ERROR_CODE'
int i, ret = DMA_ERROR_CODE;
^
-------------------
Remove the actually unneeded initialization of "ret" in
__iommu_create_mapping() and move the variable declaration inside the
for-loop to make the scope of this variable more clear.
Signed-off-by: Andre Przywara <andre.przywara@arm.com>
---
arch/arm/mm/dma-mapping.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
Hi Russell,
I hope that hasn't turned up before, but this triggers with my config.
Please apply for 4.3.
Cheers,
Andre.
diff --git a/arch/arm/mm/dma-mapping.c b/arch/arm/mm/dma-mapping.c
index e626043..1a7815e 100644
--- a/arch/arm/mm/dma-mapping.c
+++ b/arch/arm/mm/dma-mapping.c
@@ -1249,7 +1249,7 @@ __iommu_create_mapping(struct device *dev, struct page **pages, size_t size)
struct dma_iommu_mapping *mapping = to_dma_iommu_mapping(dev);
unsigned int count = PAGE_ALIGN(size) >> PAGE_SHIFT;
dma_addr_t dma_addr, iova;
- int i, ret = DMA_ERROR_CODE;
+ int i;
dma_addr = __alloc_iova(mapping, size);
if (dma_addr == DMA_ERROR_CODE)
@@ -1257,6 +1257,8 @@ __iommu_create_mapping(struct device *dev, struct page **pages, size_t size)
iova = dma_addr;
for (i = 0; i < count; ) {
+ int ret;
+
unsigned int next_pfn = page_to_pfn(pages[i]) + 1;
phys_addr_t phys = page_to_phys(pages[i]);
unsigned int len, j;
--
2.5.1
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] arm: dma-mapping: fix build warning with new DMA_ERROR_CODE definition
2015-09-14 16:13 [PATCH] arm: dma-mapping: fix build warning with new DMA_ERROR_CODE definition Andre Przywara
@ 2015-09-14 16:31 ` Russell King - ARM Linux
0 siblings, 0 replies; 2+ messages in thread
From: Russell King - ARM Linux @ 2015-09-14 16:31 UTC (permalink / raw)
To: Andre Przywara
Cc: linux-arm-kernel, will.deacon, catalin.marinas, Marek Szyprowski,
linux-kernel
On Mon, Sep 14, 2015 at 05:13:18PM +0100, Andre Przywara wrote:
> Commit 96231b2686b5: ("ARM: 8419/1: dma-mapping: harmonize definition
> of DMA_ERROR_CODE") changed the definition of DMA_ERROR_CODE to use
> dma_addr_t, which makes the compiler barf on assigning this to an
> "int" variable on ARM with LPAE enabled:
> -------------------
> In file included from /src/linux/include/linux/dma-mapping.h:86:0,
> from /src/linux/arch/arm/mm/dma-mapping.c:21:
> /src/linux/arch/arm/mm/dma-mapping.c: In function '__iommu_create_mapping':
> /src/linux/arch/arm/include/asm/dma-mapping.h:16:24: warning:
> overflow in implicit constant conversion [-Woverflow]
> #define DMA_ERROR_CODE (~(dma_addr_t)0x0)
> ^
> /src/linux/arch/arm/mm/dma-mapping.c:1252:15: note: in expansion of
> macro DMA_ERROR_CODE'
> int i, ret = DMA_ERROR_CODE;
> ^
It's absolutely right to barf on this. DMA_ERROR_CODE is _supposed_
to be a dma_addr_t cookie. It isn't an int.
> Remove the actually unneeded initialization of "ret" in
> __iommu_create_mapping() and move the variable declaration inside the
> for-loop to make the scope of this variable more clear.
>
> Signed-off-by: Andre Przywara <andre.przywara@arm.com>
> ---
> arch/arm/mm/dma-mapping.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> Hi Russell,
>
> I hope that hasn't turned up before, but this triggers with my config.
> Please apply for 4.3.
The patch looks correct, please put it in the patch system, thanks.
--
FTTC broadband for 0.8mile line: currently at 9.6Mbps down 400kbps up
according to speedtest.net.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2015-09-14 16:32 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-09-14 16:13 [PATCH] arm: dma-mapping: fix build warning with new DMA_ERROR_CODE definition Andre Przywara
2015-09-14 16:31 ` Russell King - ARM Linux
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®