[PATCH staging 3/3] wilc1000 : Use BIT() macro where possible
Anish Bhatt
anish at gatech.edu
Fri Sep 25 16:14:29 UTC 2015
On Fri, Sep 25, 2015 at 3:50 AM, Dan Carpenter <dan.carpenter at oracle.com> 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
More information about the devel
mailing list