diff mbox

ARM: OMAP2: add type cast from 'unsigned' to 'signed'

Message ID 521479B4.8030604@asianux.com (mailing list archive)
State New, archived
Headers show

Commit Message

Chen Gang Aug. 21, 2013, 8:26 a.m. UTC
Need add type cast, or can not notice the failure. The related warning
(allmodconfig, "EXTRA_CFLAGS=-W"):

  arch/arm/mach-omap2/gpmc.c:728:2: warning: comparison of unsigned expression < 0 is always false [-Wtype-limits]


Signed-off-by: Chen Gang <gang.chen@asianux.com>
---
 arch/arm/mach-omap2/gpmc.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

Comments

Tony Lindgren Aug. 22, 2013, 7:14 a.m. UTC | #1
* Chen Gang <gang.chen@asianux.com> [130821 01:34]:
> Need add type cast, or can not notice the failure. The related warning
> (allmodconfig, "EXTRA_CFLAGS=-W"):
> 
>   arch/arm/mach-omap2/gpmc.c:728:2: warning: comparison of unsigned expression < 0 is always false [-Wtype-limits]
> 
> 
> Signed-off-by: Chen Gang <gang.chen@asianux.com>
> ---
>  arch/arm/mach-omap2/gpmc.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/arch/arm/mach-omap2/gpmc.c b/arch/arm/mach-omap2/gpmc.c
> index f3fdd6a..62377b5 100644
> --- a/arch/arm/mach-omap2/gpmc.c
> +++ b/arch/arm/mach-omap2/gpmc.c
> @@ -725,7 +725,7 @@ static int gpmc_setup_irq(void)
>  		return -EINVAL;
>  
>  	gpmc_irq_start = irq_alloc_descs(-1, 0, GPMC_NR_IRQ, 0);
> -	if (gpmc_irq_start < 0) {
> +	if ((signed)gpmc_irq_start < 0) {
>  		pr_err("irq_alloc_descs failed\n");
>  		return gpmc_irq_start;
>  	}

Hmm shouldn't we just have int gpmc_irq_start instead
of unsigned gpmc_irq_start?

Regards,

Tony
Chen Gang Aug. 22, 2013, 7:43 a.m. UTC | #2
On 08/22/2013 03:14 PM, Tony Lindgren wrote:
> * Chen Gang <gang.chen@asianux.com> [130821 01:34]:
>> Need add type cast, or can not notice the failure. The related warning
>> (allmodconfig, "EXTRA_CFLAGS=-W"):
>>
>>   arch/arm/mach-omap2/gpmc.c:728:2: warning: comparison of unsigned expression < 0 is always false [-Wtype-limits]
>>
>>
>> Signed-off-by: Chen Gang <gang.chen@asianux.com>
>> ---
>>  arch/arm/mach-omap2/gpmc.c |    2 +-
>>  1 files changed, 1 insertions(+), 1 deletions(-)
>>
>> diff --git a/arch/arm/mach-omap2/gpmc.c b/arch/arm/mach-omap2/gpmc.c
>> index f3fdd6a..62377b5 100644
>> --- a/arch/arm/mach-omap2/gpmc.c
>> +++ b/arch/arm/mach-omap2/gpmc.c
>> @@ -725,7 +725,7 @@ static int gpmc_setup_irq(void)
>>  		return -EINVAL;
>>  
>>  	gpmc_irq_start = irq_alloc_descs(-1, 0, GPMC_NR_IRQ, 0);
>> -	if (gpmc_irq_start < 0) {
>> +	if ((signed)gpmc_irq_start < 0) {
>>  		pr_err("irq_alloc_descs failed\n");
>>  		return gpmc_irq_start;
>>  	}
> 
> Hmm shouldn't we just have int gpmc_irq_start instead
> of unsigned gpmc_irq_start?
>

Oh, thanks, that sounds reasonable to me, I will send patch v2.


> Regards,
> 
> Tony
> 
> 

Thanks.
diff mbox

Patch

diff --git a/arch/arm/mach-omap2/gpmc.c b/arch/arm/mach-omap2/gpmc.c
index f3fdd6a..62377b5 100644
--- a/arch/arm/mach-omap2/gpmc.c
+++ b/arch/arm/mach-omap2/gpmc.c
@@ -725,7 +725,7 @@  static int gpmc_setup_irq(void)
 		return -EINVAL;
 
 	gpmc_irq_start = irq_alloc_descs(-1, 0, GPMC_NR_IRQ, 0);
-	if (gpmc_irq_start < 0) {
+	if ((signed)gpmc_irq_start < 0) {
 		pr_err("irq_alloc_descs failed\n");
 		return gpmc_irq_start;
 	}