Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1413622 > unrolled thread

[PATCH] dma: bcm2835: Fix compiler warning on arm64.

Started byEric Anholt <eric@anholt.net>
First post2016-06-04 04:30 +0200
Last post2016-06-06 19:20 +0200
Articles 3 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH] dma: bcm2835: Fix compiler warning on arm64. Eric Anholt <eric@anholt.net> - 2016-06-04 04:30 +0200
    Re: [PATCH] dma: bcm2835: Fix compiler warning on arm64. Vinod Koul <vinod.koul@intel.com> - 2016-06-06 06:20 +0200
      Re: [PATCH] dma: bcm2835: Fix compiler warning on arm64. Eric Anholt <eric@anholt.net> - 2016-06-06 19:20 +0200

#1413622 — [PATCH] dma: bcm2835: Fix compiler warning on arm64.

FromEric Anholt <eric@anholt.net>
Date2016-06-04 04:30 +0200
Subject[PATCH] dma: bcm2835: Fix compiler warning on arm64.
Message-ID<rG9vz-2XA-5@gated-at.bofh.it>
The min() macro was complaining about mismatched types.  The max len
is at most SZ_1G, so we can just put it in an unsigned int.

Signed-off-by: Eric Anholt <eric@anholt.net>
---

Vinod, if you ack it, this one would be nice to be able to merge
through the -soc tree, so that when we enable of arm64 builds of this
driver we don't introduce a new compiler warning.

 drivers/dma/bcm2835-dma.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/dma/bcm2835-dma.c b/drivers/dma/bcm2835-dma.c
index 6149b27c33ad..1fa11fc067c6 100644
--- a/drivers/dma/bcm2835-dma.c
+++ b/drivers/dma/bcm2835-dma.c
@@ -393,7 +393,7 @@ static void bcm2835_dma_fill_cb_chain_with_sg(
 	unsigned int sg_len)
 {
 	struct bcm2835_chan *c = to_bcm2835_dma_chan(chan);
-	size_t max_len = bcm2835_dma_max_frame_length(c);
+	unsigned int max_len = bcm2835_dma_max_frame_length(c);
 	unsigned int i, len;
 	dma_addr_t addr;
 	struct scatterlist *sgent;
-- 
2.8.0.rc3

[toc] | [next] | [standalone]


#1414616

FromVinod Koul <vinod.koul@intel.com>
Date2016-06-06 06:20 +0200
Message-ID<rGUb7-8fk-9@gated-at.bofh.it>
In reply to#1413622
On Fri, Jun 03, 2016 at 07:23:33PM -0700, Eric Anholt wrote:
> The min() macro was complaining about mismatched types.  The max len
> is at most SZ_1G, so we can just put it in an unsigned int.
> 
> Signed-off-by: Eric Anholt <eric@anholt.net>
> ---
> 
> Vinod, if you ack it, this one would be nice to be able to merge
> through the -soc tree, so that when we enable of arm64 builds of this
> driver we don't introduce a new compiler warning.
> 
>  drivers/dma/bcm2835-dma.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/dma/bcm2835-dma.c b/drivers/dma/bcm2835-dma.c
> index 6149b27c33ad..1fa11fc067c6 100644
> --- a/drivers/dma/bcm2835-dma.c
> +++ b/drivers/dma/bcm2835-dma.c
> @@ -393,7 +393,7 @@ static void bcm2835_dma_fill_cb_chain_with_sg(
>  	unsigned int sg_len)
>  {
>  	struct bcm2835_chan *c = to_bcm2835_dma_chan(chan);
> -	size_t max_len = bcm2835_dma_max_frame_length(c);
> +	unsigned int max_len = bcm2835_dma_max_frame_length(c);

bcm2835_dma_max_frame_length() returns size_t. so this should also add a
complain about type mismatch as well!

Also, wouldn't it be better to make both args of min()  as size_t then?

>  	unsigned int i, len;
>  	dma_addr_t addr;
>  	struct scatterlist *sgent;
> -- 
> 2.8.0.rc3
> 

Thanks
-- 
~Vinod

[toc] | [prev] | [next] | [standalone]


#1415303

FromEric Anholt <eric@anholt.net>
Date2016-06-06 19:20 +0200
Message-ID<rH6lY-7QH-27@gated-at.bofh.it>
In reply to#1414616

[Multipart message — attachments visible in raw view] — view raw

Vinod Koul <vinod.koul@intel.com> writes:

> On Fri, Jun 03, 2016 at 07:23:33PM -0700, Eric Anholt wrote:
>> The min() macro was complaining about mismatched types.  The max len
>> is at most SZ_1G, so we can just put it in an unsigned int.
>> 
>> Signed-off-by: Eric Anholt <eric@anholt.net>
>> ---
>> 
>> Vinod, if you ack it, this one would be nice to be able to merge
>> through the -soc tree, so that when we enable of arm64 builds of this
>> driver we don't introduce a new compiler warning.
>> 
>>  drivers/dma/bcm2835-dma.c | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>> 
>> diff --git a/drivers/dma/bcm2835-dma.c b/drivers/dma/bcm2835-dma.c
>> index 6149b27c33ad..1fa11fc067c6 100644
>> --- a/drivers/dma/bcm2835-dma.c
>> +++ b/drivers/dma/bcm2835-dma.c
>> @@ -393,7 +393,7 @@ static void bcm2835_dma_fill_cb_chain_with_sg(
>>  	unsigned int sg_len)
>>  {
>>  	struct bcm2835_chan *c = to_bcm2835_dma_chan(chan);
>> -	size_t max_len = bcm2835_dma_max_frame_length(c);
>> +	unsigned int max_len = bcm2835_dma_max_frame_length(c);
>
> bcm2835_dma_max_frame_length() returns size_t. so this should also add a
> complain about type mismatch as well!
>
> Also, wouldn't it be better to make both args of min()  as size_t then?

Assignments from different sizes don't produce warnings.  The other arg
of the min() is a u32, and this value is known to be < u32, so I don't
see the problem.  I could start promoting u32s to size_ts instead, but I
don't know where that would end.

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web