On 05/15/2013 02:48 PM, Dan Carpenter wrote:
> On Wed, May 15, 2013 at 10:51:58AM +0800, Chen Gang wrote:
>> > 
>> > HCF_MAX_NAME_LEN is 32, which may less than ''probe_rsp->rawData[1]'',
>> > so need check the length when copy to ssid.
>> > 
>> > Type of 'probe_rsp->rawData[1]' is 'hcf_8' which is 'unsigned char',
>> > it will compare with 'int', so use min_t() to cast to 'int' to avoid
>> > related warning.
>> > 
>> > If use min(), it has '(void) (&_min1 == &_min2);', so if no type cast,
>> > the compiler will report 'pointer types lacks a cast':
>> > 
>> >   drivers/staging/wlags49_h2/wl_main.c:3174:122: warning: comparison of 
>> > distinct pointer types lacks a cast [enabled by default]
>> > 
>> > 
>> > 
>> > Signed-off-by: root <[email protected]>
>                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> 
> Oops.
> 
> Of course, I wish you had used min_t(u8, for the reasons I described
> before but int also works fine.

The 2 variables for comparing: one is 'u8', the other is 'int'. Since
'int' is 'bigger' than 'u8', I like cast to 'int' (it is the 'default
habit') ;-)

Could you describe the details again for why 'u8' is better than 'int' ?


Thanks.
-- 
Chen Gang

Asianux Corporation
_______________________________________________
devel mailing list
[email protected]
http://driverdev.linuxdriverproject.org/mailman/listinfo/devel

Reply via email to