Search Linux Wireless

Re: [PATCH] b43: Fix sparse warnings

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

 



On Fri, 2009-08-14 at 22:15 +0200, Michael Buesch wrote:

> > -			b43_phy_mask(dev, 0x048A, (u16)~0x8000);
> > +			b43_phy_mask(dev, 0x048A, (u16)(~0x8000 & 0xFFFF));
> 
> Uh come on...
> The u16 cast already is stupid as hell, but this is becoming braindead.
> The code is perfectly fine. Sparse should instead provide an option to disable
> this fragile check.

There are cases where we want to know that a constant was truncated.  In
fact, in most cases it's a useful warning.

In this case, we intuitively expect that it's OK to cast a result of a
bitwise operation to its original type, as if it was never promoted.
But sparse will need to have a special exception for this case.

I would just use 0x7fff here.

-- 
Regards,
Pavel Roskin
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Host AP]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Linux Kernel]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]
  Powered by Linux