2023-03-19 04:51:07

by kernel test robot

[permalink] [raw]
Subject: [bluetooth-next:master 57/57] drivers/bluetooth/btnxpuart.c:844:36: sparse: sparse: incorrect type in argument 3 (different base types)

tree: https://git.kernel.org/pub/scm/linux/kernel/git/bluetooth/bluetooth-next.git master
head: 3e662aa4453a38568731c6319319a3a85e2f2f96
commit: 3e662aa4453a38568731c6319319a3a85e2f2f96 [57/57] Bluetooth: NXP: Add protocol support for NXP Bluetooth chipsets
config: arm64-randconfig-s052-20230319 (https://download.01.org/0day-ci/archive/20230319/[email protected]/config)
compiler: aarch64-linux-gcc (GCC) 12.1.0
reproduce:
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# apt-get install sparse
# sparse version: v0.6.4-39-gce1a6720-dirty
# https://git.kernel.org/pub/scm/linux/kernel/git/bluetooth/bluetooth-next.git/commit/?id=3e662aa4453a38568731c6319319a3a85e2f2f96
git remote add bluetooth-next https://git.kernel.org/pub/scm/linux/kernel/git/bluetooth/bluetooth-next.git
git fetch --no-tags bluetooth-next master
git checkout 3e662aa4453a38568731c6319319a3a85e2f2f96
# save the config file
mkdir build_dir && cp config build_dir/.config
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' O=build_dir ARCH=arm64 olddefconfig
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' O=build_dir ARCH=arm64 SHELL=/bin/bash drivers/bluetooth/

If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <[email protected]>
| Link: https://lore.kernel.org/oe-kbuild-all/[email protected]/

sparse warnings: (new ones prefixed by >>)
drivers/bluetooth/btnxpuart.c:681:23: sparse: sparse: restricted __le16 degrades to integer
drivers/bluetooth/btnxpuart.c:690:82: sparse: sparse: incorrect type in argument 2 (different base types) @@ expected unsigned short [usertype] req_len @@ got restricted __le16 [usertype] len @@
drivers/bluetooth/btnxpuart.c:690:82: sparse: expected unsigned short [usertype] req_len
drivers/bluetooth/btnxpuart.c:690:82: sparse: got restricted __le16 [usertype] len
drivers/bluetooth/btnxpuart.c:694:84: sparse: sparse: incorrect type in argument 2 (different base types) @@ expected unsigned short [usertype] req_len @@ got restricted __le16 [usertype] len @@
drivers/bluetooth/btnxpuart.c:694:84: sparse: expected unsigned short [usertype] req_len
drivers/bluetooth/btnxpuart.c:694:84: sparse: got restricted __le16 [usertype] len
drivers/bluetooth/btnxpuart.c:708:23: sparse: sparse: incorrect type in assignment (different base types) @@ expected unsigned int [usertype] requested_len @@ got restricted __le16 [usertype] len @@
drivers/bluetooth/btnxpuart.c:708:23: sparse: expected unsigned int [usertype] requested_len
drivers/bluetooth/btnxpuart.c:708:23: sparse: got restricted __le16 [usertype] len
drivers/bluetooth/btnxpuart.c:787:78: sparse: sparse: incorrect type in argument 2 (different base types) @@ expected unsigned short [usertype] chipid @@ got restricted __le16 [usertype] chip_id @@
drivers/bluetooth/btnxpuart.c:787:78: sparse: expected unsigned short [usertype] chipid
drivers/bluetooth/btnxpuart.c:787:78: sparse: got restricted __le16 [usertype] chip_id
drivers/bluetooth/btnxpuart.c:810:74: sparse: sparse: incorrect type in argument 2 (different base types) @@ expected unsigned short [usertype] req_len @@ got restricted __le16 [usertype] len @@
drivers/bluetooth/btnxpuart.c:810:74: sparse: expected unsigned short [usertype] req_len
drivers/bluetooth/btnxpuart.c:810:74: sparse: got restricted __le16 [usertype] len
drivers/bluetooth/btnxpuart.c:815:76: sparse: sparse: incorrect type in argument 2 (different base types) @@ expected unsigned short [usertype] req_len @@ got restricted __le16 [usertype] len @@
drivers/bluetooth/btnxpuart.c:815:76: sparse: expected unsigned short [usertype] req_len
drivers/bluetooth/btnxpuart.c:815:76: sparse: got restricted __le16 [usertype] len
drivers/bluetooth/btnxpuart.c:834:16: sparse: sparse: restricted __le32 degrades to integer
drivers/bluetooth/btnxpuart.c:843:55: sparse: sparse: restricted __le32 degrades to integer
>> drivers/bluetooth/btnxpuart.c:844:36: sparse: sparse: incorrect type in argument 3 (different base types) @@ expected unsigned long [usertype] @@ got restricted __le16 [usertype] len @@
drivers/bluetooth/btnxpuart.c:844:36: sparse: expected unsigned long [usertype]
drivers/bluetooth/btnxpuart.c:844:36: sparse: got restricted __le16 [usertype] len

vim +844 drivers/bluetooth/btnxpuart.c

794
795 static int nxp_recv_fw_req_v3(struct hci_dev *hdev, struct sk_buff *skb)
796 {
797 struct btnxpuart_dev *nxpdev = hci_get_drvdata(hdev);
798 struct v3_data_req *req;
799
800 if (!process_boot_signature(nxpdev))
801 goto free_skb;
802
803 req = (struct v3_data_req *)skb_pull_data(skb, sizeof(struct v3_data_req));
804 if (!req || !nxpdev->fw)
805 goto free_skb;
806
807 nxp_send_ack(NXP_ACK_V3, hdev);
808
809 if (!nxpdev->timeout_changed) {
810 nxpdev->timeout_changed = nxp_fw_change_timeout(hdev, req->len);
811 goto free_skb;
812 }
813
814 if (!nxpdev->baudrate_changed) {
815 nxpdev->baudrate_changed = nxp_fw_change_baudrate(hdev, req->len);
816 if (nxpdev->baudrate_changed) {
817 serdev_device_set_baudrate(nxpdev->serdev,
818 HCI_NXP_SEC_BAUDRATE);
819 serdev_device_set_flow_control(nxpdev->serdev, 1);
820 nxpdev->current_baudrate = HCI_NXP_SEC_BAUDRATE;
821 }
822 goto free_skb;
823 }
824
825 if (req->len == 0) {
826 bt_dev_dbg(hdev, "FW Downloaded Successfully: %zu bytes", nxpdev->fw->size);
827 clear_bit(BTNXPUART_FW_DOWNLOADING, &nxpdev->tx_state);
828 wake_up_interruptible(&nxpdev->fw_dnld_done_wait_q);
829 goto free_skb;
830 }
831 if (req->error)
832 bt_dev_dbg(hdev, "FW Download received err 0x%02x from chip", req->error);
833
834 if (req->offset < nxpdev->fw_v3_offset_correction) {
835 /* This scenario should ideally never occur. But if it ever does,
836 * FW is out of sync and needs a power cycle.
837 */
838 bt_dev_err(hdev, "Something went wrong during FW download. Please power cycle and try again");
839 goto free_skb;
840 }
841
842 serdev_device_write_buf(nxpdev->serdev,
843 nxpdev->fw->data + req->offset - nxpdev->fw_v3_offset_correction,
> 844 req->len);
845
846 free_skb:
847 kfree_skb(skb);
848 return 0;
849 }
850

--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests