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 10:47 PM, Dan Carpenter
<dan.carpenter@xxxxxxxxxx> wrote:
> On Fri, Sep 25, 2015 at 09:14:29AM -0700, Anish Bhatt wrote:
>> 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.
>>
>
> Is that a default warning?
>
> As static checker warnings go that is a stupid warning.  I have a
> similar check in Smatch but I haven't published it because it's a stupid
> to warning.
>
> regards,
> dan carpenter
>

If you mean -Woverflow,  then that's a gcc warning, not a static checker
warning.

-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