Re: [PATCH staging 3/3] wilc1000 : Use BIT() macro where possible

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Sep 25, 2015 at 3:50 AM, Dan Carpenter <dan.carpenter@xxxxxxxxxx> wrote:
> On Fri, Sep 25, 2015 at 12:45:17AM -0700, Anish Bhatt wrote:
>> @@ -1672,11 +1673,11 @@ static int wilc_wlan_stop(void)
>>               }
>>
>>       } while (timeout);
>> -     reg = ((1 << 0) | (1 << 1) | (1 << 2) | (1 << 3) | (1 << 8) |
>> -            (1 << 9) | (1 << 26) | (1 << 29) | (1 << 30) | (1 << 31));
>> +     reg = (BIT(0) | BIT(1) | BIT(2) | BIT(3) | BIT(8) | BIT(9) | BIT(26) |
>> +            BIT(29) | BIT(30) | BIT(31));
>>
>>       p->hif_func.hif_write_reg(WILC_GLB_RESET_0, reg);
>> -     reg = ~(1 << 10);
>> +     reg = (u32)~BIT(10);
>
> Why did you add this cast?  There is no need.
>
> regards,
> dan carpenter
>

Since BIT(x) is defined as (1UL << x), ~BIT here results in a unsigned
long being stored in a u32,
giving a -Woverflow warning. The cast fixes this.

-Anish
_______________________________________________
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel



[Index of Archives]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux