RE: [patch] staging: comedi: dt9812: Resolves sparse endian warnings.

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

 



On Friday, July 26, 2013 10:59 AM, Shaun Laing wrote:

Please make sure to copy the mailing list... ;-)

> I'm sorry Hartley,
>
> I'm really new at this so there's probably something I'm doing wrong.
> Do you have time to help me figure this out?  Here's how I'm building
> this module:
>
> shaun@rivendell:~/src/linux/staging$ make O=../staging-build C=1
> CF=-D__CHECK_ENDIAN__ drivers/staging/comedi/drivers/dt9812.o

Ah.. That's the difference.

I usually don't pass the CF=-D__CHECK_ENDIAN__ option.

With that option it appears there are a number of comedi drivers that
have some endian issues.

Your patch does fix these four in the dt9812 driver:

drivers/staging/comedi/drivers/dt9812.c:739:18: warning: cast to restricted __le16
drivers/staging/comedi/drivers/dt9812.c:746:19: warning: cast to restricted __le16
drivers/staging/comedi/drivers/dt9812.c:753:27: warning: cast to restricted __le16
drivers/staging/comedi/drivers/dt9812.c:760:18: warning: cast to restricted __le32

So, FWIW:

Reviewed-by: H Hartley Sweeten <hsweeten@xxxxxxxxxxxxxxxxxxx>


These endian warnings still exist in the driver:

drivers/staging/comedi/drivers/dt9812.c:260:17: warning: incorrect type in assignment (different base types)
drivers/staging/comedi/drivers/dt9812.c:260:17:    expected unsigned int [unsigned] [usertype] cmd
drivers/staging/comedi/drivers/dt9812.c:260:17:    got restricted __le32 [usertype] <noident>
drivers/staging/comedi/drivers/dt9812.c:261:39: warning: incorrect type in assignment (different base types)
drivers/staging/comedi/drivers/dt9812.c:261:39:    expected unsigned short [unsigned] [usertype] address
drivers/staging/comedi/drivers/dt9812.c:261:39:    got restricted __le16 [usertype] <noident>
drivers/staging/comedi/drivers/dt9812.c:263:40: warning: incorrect type in assignment (different base types)
drivers/staging/comedi/drivers/dt9812.c:263:40:    expected unsigned short [unsigned] [usertype] numbytes
drivers/staging/comedi/drivers/dt9812.c:263:40:    got restricted __le16 [usertype] <noident>
drivers/staging/comedi/drivers/dt9812.c:284:17: warning: incorrect type in assignment (different base types)
drivers/staging/comedi/drivers/dt9812.c:284:17:    expected unsigned int [unsigned] [usertype] cmd
drivers/staging/comedi/drivers/dt9812.c:284:17:    got restricted __le32 [usertype] <noident>
drivers/staging/comedi/drivers/dt9812.c:308:17: warning: incorrect type in assignment (different base types)
drivers/staging/comedi/drivers/dt9812.c:308:17:    expected unsigned int [unsigned] [usertype] cmd
drivers/staging/comedi/drivers/dt9812.c:308:17:    got restricted __le32 [usertype] <noident>
drivers/staging/comedi/drivers/dt9812.c:329:17: warning: incorrect type in assignment (different base types)
drivers/staging/comedi/drivers/dt9812.c:329:17:    expected unsigned int [unsigned] [usertype] cmd
drivers/staging/comedi/drivers/dt9812.c:329:17:    got restricted __le32 [usertype] <noident>

It appears they can be "fixed" by changing the types in the struct dt9812_flash_data
and struct dt9812_usb_cmd. But I'm not positive if this is the "correct" fix. Hopefully
someone with a bit more endian knowledge will comment. If they do, and this is the
right fix, feel free to add this chunk to your patch.

Regards,
Hartley



@@ -188,8 +188,8 @@ enum {
 };
 
 struct dt9812_flash_data {
-       u16 numbytes;
-       u16 address;
+       __le16 numbytes;
+       __le16 address;
 };
 
 #define DT9812_MAX_NUM_MULTI_BYTE_RDS  \
@@ -230,7 +230,7 @@ struct dt9812_rmw_multi {
 };
 
 struct dt9812_usb_cmd {
-       u32 cmd;
+       __le32 cmd;
        union {
                struct dt9812_flash_data flash_data_info;
                struct dt9812_read_multi read_multi_info;



_______________________________________________
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