Re: [PATCH v3 1/1] can: ucan: add driver for Theobroma Systems UCAN devices

From: Martin Elshuber
Date: Tue Mar 27 2018 - 06:20:37 EST


fixed and rechecked again with sparse

Am 24.03.18 um 12:43 schrieb kbuild test robot:
> Hi Jakob,
>
> Thank you for the patch! Perhaps something to improve:
>
> [auto build test WARNING on net-next/master]
> [also build test WARNING on v4.16-rc6]
> [cannot apply to next-20180323]
> [if your patch is applied to the wrong git tree, please drop us a note to help improve the system]
>
> url: https://github.com/0day-ci/linux/commits/Jakob-Unterwurzacher/can-ucan-add-driver-for-Theobroma-Systems-UCAN-devices/20180324-164143
> reproduce:
> # apt-get install sparse
> make ARCH=x86_64 allmodconfig
> make C=1 CF=-D__CHECK_ENDIAN__
>
>
> sparse warnings: (new ones prefixed by >>)
>
>>> drivers/net/can/usb/ucan.c:301:16: sparse: restricted __le32 degrades to integer
> drivers/net/can/usb/ucan.c:414:32: sparse: incorrect type in argument 5 (different base types) @@ expected unsigned short [unsigned] [usertype] value @@ got short [unsigned] [usertype] value @@
> drivers/net/can/usb/ucan.c:414:32: expected unsigned short [unsigned] [usertype] value
> drivers/net/can/usb/ucan.c:414:32: got restricted __le16 [usertype] <noident>
> drivers/net/can/usb/ucan.c:428:32: sparse: incorrect type in argument 5 (different base types) @@ expected unsigned short [unsigned] [usertype] value @@ got short [unsigned] [usertype] value @@
> drivers/net/can/usb/ucan.c:428:32: expected unsigned short [unsigned] [usertype] value
> drivers/net/can/usb/ucan.c:428:32: got restricted __le16 [usertype] <noident>
> drivers/net/can/usb/ucan.c:683:44: sparse: incorrect type in argument 2 (different base types) @@ expected unsigned long [unsigned] [usertype] size @@ got d long [unsigned] [usertype] size @@
> drivers/net/can/usb/ucan.c:683:44: expected unsigned long [unsigned] [usertype] size
> drivers/net/can/usb/ucan.c:683:44: got restricted __le16 [usertype] wMaxPacketSize
> drivers/net/can/usb/ucan.c:700:44: sparse: incorrect type in argument 2 (different base types) @@ expected unsigned long [unsigned] [usertype] size @@ got d long [unsigned] [usertype] size @@
> drivers/net/can/usb/ucan.c:700:44: expected unsigned long [unsigned] [usertype] size
> drivers/net/can/usb/ucan.c:700:44: got restricted __le16 [usertype] wMaxPacketSize
> drivers/net/can/usb/ucan.c:752:25: sparse: cast to restricted __le16
> drivers/net/can/usb/ucan.c:779:36: sparse: incorrect type in argument 5 (different base types) @@ expected int [signed] buffer_length @@ got restricted __le1int [signed] buffer_length @@
> drivers/net/can/usb/ucan.c:779:36: expected int [signed] buffer_length
> drivers/net/can/usb/ucan.c:779:36: got restricted __le16 [usertype] wMaxPacketSize
> drivers/net/can/usb/ucan.c:793:54: sparse: incorrect type in argument 2 (different base types) @@ expected unsigned long [unsigned] [usertype] size @@ got d long [unsigned] [usertype] size @@
> drivers/net/can/usb/ucan.c:793:54: expected unsigned long [unsigned] [usertype] size
> drivers/net/can/usb/ucan.c:793:54: got restricted __le16 [usertype] wMaxPacketSize
> drivers/net/can/usb/ucan.c:853:62: sparse: incorrect type in argument 2 (different base types) @@ expected unsigned long [unsigned] [usertype] size @@ got d long [unsigned] [usertype] size @@
> drivers/net/can/usb/ucan.c:853:62: expected unsigned long [unsigned] [usertype] size
> drivers/net/can/usb/ucan.c:853:62: got restricted __le16 [usertype] wMaxPacketSize
> drivers/net/can/usb/ucan.c:877:61: sparse: incorrect type in argument 2 (different base types) @@ expected unsigned long [unsigned] [usertype] size @@ got d long [unsigned] [usertype] size @@
> drivers/net/can/usb/ucan.c:877:61: expected unsigned long [unsigned] [usertype] size
> drivers/net/can/usb/ucan.c:877:61: got restricted __le16 [usertype] wMaxPacketSize
> drivers/net/can/usb/ucan.c:891:44: sparse: incorrect type in argument 5 (different base types) @@ expected int [signed] buffer_length @@ got restricted __le1int [signed] buffer_length @@
> drivers/net/can/usb/ucan.c:891:44: expected int [signed] buffer_length
> drivers/net/can/usb/ucan.c:891:44: got restricted __le16 [usertype] wMaxPacketSize
>>> drivers/net/can/usb/ucan.c:1238:41: sparse: incorrect type in assignment (different base types) @@ expected restricted __le16 [usertype] sample_point @@ got restricted __le16 [usertype] sample_point @@
> drivers/net/can/usb/ucan.c:1238:41: expected restricted __le16 [usertype] sample_point
> drivers/net/can/usb/ucan.c:1238:41: got restricted __le32 [usertype] <noident>
> drivers/net/can/usb/ucan.c:1368:18: sparse: restricted __le16 degrades to integer
> drivers/net/can/usb/ucan.c:1373:19: sparse: restricted __le16 degrades to integer
> drivers/net/can/usb/ucan.c:1407:31: sparse: incorrect type in argument 5 (different base types) @@ expected unsigned short [unsigned] [usertype] value @@ got short [unsigned] [usertype] value @@
> drivers/net/can/usb/ucan.c:1407:31: expected unsigned short [unsigned] [usertype] value
> drivers/net/can/usb/ucan.c:1407:31: got restricted __le16 [usertype] <noident>
> drivers/net/can/usb/ucan.c:1448:31: sparse: incorrect type in argument 5 (different base types) @@ expected unsigned short [unsigned] [usertype] value @@ got short [unsigned] [usertype] value @@
> drivers/net/can/usb/ucan.c:1448:31: expected unsigned short [unsigned] [usertype] value
> drivers/net/can/usb/ucan.c:1448:31: got restricted __le16 [usertype] <noident>
>
> vim +301 drivers/net/can/usb/ucan.c
>
> 298
> 299 static u8 ucan_get_can_dlc(struct ucan_can_msg *msg, u16 len)
> 300 {
> > 301 if (msg->id & CAN_RTR_FLAG)
> 302 return get_can_dlc(msg->dlc);
> 303 else
> 304 return get_can_dlc(len - (UCAN_IN_HDR_SIZE + sizeof(msg->id)));
> 305 }
> 306
>
> ---
> 0-DAY kernel test infrastructure Open Source Technology Center
> https://lists.01.org/pipermail/kbuild-all Intel Corporation

--
Martin Elshuber
Theobroma Systems Design und Consulting GmbH
SeestadtstraÃe 27 (Aspern IQ), 1220 Wien, Austria
Phone: +43 1 236 98 93-405, Fax: +43 1 236 98 93-9
http://www.theobroma-systems.com


Attachment: signature.asc
Description: OpenPGP digital signature