Re: Warning with asm-generic/div64.h

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

 



On Friday 25 March 2011, Guan Xuetao wrote:
> Following warning is generated when using <asm-generic/div64.h>
> 
> kernel/power/hibernate.c: In function 'swsusp_show_speed':
> kernel/power/hibernate.c:227: warning: comparison of distinct pointer types lacks a cast
> 
> After expanding the do_div() macro, the problem line is:
> 
>         (void)(((typeof((n)) *)0) == ((uint64_t *)0));
> 
> while the type of n is s64.
> 
> I am puzzled with the usage of the problem line.
> 
> And how to correct it?

The purpose of this line is to generate a warning when the input is the
wrong type, as the comment says:
 /* The unnecessary pointer compare is there
  * to check for type safety (n must be 64bit)

The macro doesn't work for signed input or for 32 bit input. I'd suggest
fixing the caller to use an unsigned type.

	Arnd

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


[Index of Archives]     [Linux Kernel]     [Kernel Newbies]     [x86 Platform Driver]     [Netdev]     [Linux Wireless]     [Netfilter]     [Bugtraq]     [Linux Filesystems]     [Yosemite Discussion]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Device Mapper]

  Powered by Linux