diff mbox

arm: dma-mapping: add cast to DMA_ERROR_CODE

Message ID 1439653971-867-1-git-send-email-dirk.behme@gmail.com
State New
Headers show

Commit Message

Dirk Behme Aug. 15, 2015, 3:52 p.m. UTC
Fix the compiler warning

./arch/arm/include/asm/dma-mapping.h: In function ‘dma_mapping_error’:
./arch/arm/include/asm/dma-mapping.h:176:18: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  return dma_addr == DMA_ERROR_CODE;
                  ^

we get building the kernel with W=1.

This is done the same way we have already in the arm64 version.

Signed-off-by: Dirk Behme <dirk.behme@gmail.com>
---
 arch/arm/include/asm/dma-mapping.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Dirk Behme Sept. 23, 2015, 9:38 a.m. UTC | #1
On 15.08.2015 17:52, Dirk Behme wrote:
> Fix the compiler warning
>
> ./arch/arm/include/asm/dma-mapping.h: In function ‘dma_mapping_error’:
> ./arch/arm/include/asm/dma-mapping.h:176:18: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
>    return dma_addr == DMA_ERROR_CODE;
>                    ^
>
> we get building the kernel with W=1.
>
> This is done the same way we have already in the arm64 version.
>
> Signed-off-by: Dirk Behme <dirk.behme@gmail.com>
> ---
>   arch/arm/include/asm/dma-mapping.h | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/arch/arm/include/asm/dma-mapping.h b/arch/arm/include/asm/dma-mapping.h
> index b52101d..68e41e8 100644
> --- a/arch/arm/include/asm/dma-mapping.h
> +++ b/arch/arm/include/asm/dma-mapping.h
> @@ -14,7 +14,7 @@
>   #include <xen/xen.h>
>   #include <asm/xen/hypervisor.h>
>
> -#define DMA_ERROR_CODE	(~0)
> +#define DMA_ERROR_CODE	(~(dma_addr_t)0)
>   extern struct dma_map_ops arm_dma_ops;
>   extern struct dma_map_ops arm_coherent_dma_ops;


I've put this as 8420/1 into the patch system:

http://www.arm.linux.org.uk/developer/patches/viewpatch.php?id=8420/1

Any comments on this?

Best regards

Dirk
Russell King - ARM Linux Sept. 23, 2015, 9:51 a.m. UTC | #2
On Wed, Sep 23, 2015 at 11:38:24AM +0200, Dirk Behme wrote:
> On 15.08.2015 17:52, Dirk Behme wrote:
> >Fix the compiler warning
> >
> >./arch/arm/include/asm/dma-mapping.h: In function ‘dma_mapping_error’:
> >./arch/arm/include/asm/dma-mapping.h:176:18: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
> >   return dma_addr == DMA_ERROR_CODE;
> >                   ^
> >
> >we get building the kernel with W=1.
> >
> >This is done the same way we have already in the arm64 version.
> >
> >Signed-off-by: Dirk Behme <dirk.behme@gmail.com>
> >---
> >  arch/arm/include/asm/dma-mapping.h | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> >diff --git a/arch/arm/include/asm/dma-mapping.h b/arch/arm/include/asm/dma-mapping.h
> >index b52101d..68e41e8 100644
> >--- a/arch/arm/include/asm/dma-mapping.h
> >+++ b/arch/arm/include/asm/dma-mapping.h
> >@@ -14,7 +14,7 @@
> >  #include <xen/xen.h>
> >  #include <asm/xen/hypervisor.h>
> >
> >-#define DMA_ERROR_CODE	(~0)
> >+#define DMA_ERROR_CODE	(~(dma_addr_t)0)
> >  extern struct dma_map_ops arm_dma_ops;
> >  extern struct dma_map_ops arm_coherent_dma_ops;
> 
> 
> I've put this as 8420/1 into the patch system:
> 
> http://www.arm.linux.org.uk/developer/patches/viewpatch.php?id=8420/1
> 
> Any comments on this?

The reason your patch didn't get applied is because of:

commit 96231b2686b53f71838a335bdc404cb5285d1a01
Author: Marek Szyprowski <m.szyprowski@samsung.com>
Date:   Tue Aug 18 09:14:15 2015 +0100

    ARM: 8419/1: dma-mapping: harmonize definition of DMA_ERROR_CODE

    All architectures except arm that define DMA_ERROR_CODE are casting it
    to (dma_addr_t) - as it is always compared to dma_addr_t in arm as well
    this could be harmonized.

    Signed-off-by: Nicholas Mc Guire <hofrat@osadl.org>
    Acked-by: Marek Szyprowski <m.szyprowski@samsung.com>
    Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>

which does exactly the same thing as your patch, and first appeared
in June.
diff mbox

Patch

diff --git a/arch/arm/include/asm/dma-mapping.h b/arch/arm/include/asm/dma-mapping.h
index b52101d..68e41e8 100644
--- a/arch/arm/include/asm/dma-mapping.h
+++ b/arch/arm/include/asm/dma-mapping.h
@@ -14,7 +14,7 @@ 
 #include <xen/xen.h>
 #include <asm/xen/hypervisor.h>
 
-#define DMA_ERROR_CODE	(~0)
+#define DMA_ERROR_CODE	(~(dma_addr_t)0)
 extern struct dma_map_ops arm_dma_ops;
 extern struct dma_map_ops arm_coherent_dma_ops;