On Sat, Nov 18, 2006 at 07:03:52PM -0600, Jay Cliburn wrote: > I'm getting the following warning from sparse on the line marked /* L523 */ > down below. This is from an x86_64 installation of 2.6.19.rc6. I've > included the relevant structs for reference. > > I'd like to get the code fixed so sparse runs warning-free, but I'm having > trouble understanding just what the warning tells me. (This is my first > time using sparse.) Can you help by explaining it? Thanks. > > Here's the sparse error: > > drivers/net/atl1/atl1_main.c:523:25: warning: incorrect type in assignment > (different base types) > drivers/net/atl1/atl1_main.c:523:25: expected unsigned long long > [unsigned] [usertype] buffer_addr > drivers/net/atl1/atl1_main.c:523:25: got restricted unsigned long long > [usertype] [force] <noident> > *********************************************** > > Here's the source code: > /* .h snippet */ > typedef struct rx_free_desc { > u64 buffer_addr; > u16 buf_len; > u16 coalese; > } _AT_ATTRIB_PACK_ rx_free_desc_t; > > struct at_buffer { > struct sk_buff *skb; > u16 length; > u16 alloced; > dma_addr_t dma; /*dma_addr_t is u64 on my system*/ > }; > > /* .c snippet */ > struct at_buffer *buffer_info; > rx_free_desc_t *rfd_desc; > > And this is the line that generates the sparse warning: > /* L523 */ rfd_desc->buffer_addr = cpu_to_le64(buffer_info->dma); buffer_addr is not marked as __le64, which it should be if you are going to be putting a little endian 64 bit number in it. Change that and you should get rid of the sparse warning. Oh, and you know that typedefs aren't recommended to be used in the kernel, right? See the file, Documentation/CodingStyle for more details. thanks, greg k-h -- Kernelnewbies: Help each other learn about the Linux kernel. Archive: http://mail.nl.linux.org/kernelnewbies/ FAQ: http://kernelnewbies.org/faq/