Content-Type: multipart/mixed; boundary="===============4743769800769570781==" MIME-Version: 1.0 From: kbuild test robot To: kbuild-all@lists.01.org Subject: [linux-review:Balakrishna-Godavarthi/Bluetooth-hci_qca-Collect-controller-memory-dump-during-SSR/20200104-050250 1/1] drivers/bluetooth/hci_qca.c:996:26: sparse: sparse: cast to restricted __le16 Date: Sat, 04 Jan 2020 14:52:22 +0800 Message-ID: <202001041434.OjkV2qoO%lkp@intel.com> List-Id: --===============4743769800769570781== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable tree: https://github.com/0day-ci/linux/commits/Balakrishna-Godavarthi/Blu= etooth-hci_qca-Collect-controller-memory-dump-during-SSR/20200104-050250 head: c01ccc6a0ce1b4c2019cc116baaaaa804b477939 commit: c01ccc6a0ce1b4c2019cc116baaaaa804b477939 [1/1] Bluetooth: hci_qca: = Collect controller memory dump during SSR reproduce: # apt-get install sparse # sparse version: v0.6.1-129-g341daf20-dirty git checkout c01ccc6a0ce1b4c2019cc116baaaaa804b477939 make ARCH=3Dx86_64 allmodconfig make C=3D1 CF=3D'-fdiagnostic-prefix -D__CHECK_ENDIAN__' If you fix the issue, kindly add following tag Reported-by: kbuild test robot sparse warnings: (new ones prefixed by >>) >> drivers/bluetooth/hci_qca.c:996:26: sparse: sparse: cast to restricted _= _le16 drivers/bluetooth/hci_qca.c:997:26: sparse: sparse: cast to restricted _= _le16 >> drivers/bluetooth/hci_qca.c:1011:37: sparse: sparse: cast to restricted = __le32 >> drivers/bluetooth/hci_qca.c:1078:5: sparse: sparse: symbol 'qca_controll= er_memdump_event' was not declared. Should it be static? Please review and possibly fold the followup patch. vim +996 drivers/bluetooth/hci_qca.c 968 = 969 static void qca_controller_memdump(struct work_struct *work) 970 { 971 struct qca_data *qca =3D container_of(work, struct qca_data, 972 ctrl_memdump_evt); 973 struct hci_uart *hu =3D qca->hu; 974 struct sk_buff *skb; 975 struct qca_memdump_event_hdr *cmd_hdr; 976 struct qca_memdump_data *qca_memdump =3D qca->qca_memdump; 977 struct qca_dump_size *dump; 978 char *memdump_buf; 979 char nullBuff[QCA_DUMP_PACKET_SIZE] =3D { 0 }; 980 u16 opcode, seq_no; 981 u32 dump_size; 982 = 983 while ((skb =3D skb_dequeue(&qca->rx_memdump_q))) { 984 = 985 if (!qca_memdump) { 986 qca_memdump =3D kzalloc(sizeof(struct qca_memdump_data), 987 GFP_ATOMIC); 988 if (!qca_memdump) 989 return; 990 = 991 qca->qca_memdump =3D qca_memdump; 992 } 993 = 994 qca->memdump_state =3D QCA_MEMDUMP_COLLECTING; 995 cmd_hdr =3D (void *) skb->data; > 996 opcode =3D __le16_to_cpu(cmd_hdr->opcode); 997 seq_no =3D __le16_to_cpu(cmd_hdr->seq_no); 998 skb_pull(skb, sizeof(struct qca_memdump_event_hdr)); 999 = 1000 if (!seq_no) { 1001 = 1002 /* This is the first frame of memdump packet from 1003 * the controller, Disable IBS to recevie dump 1004 * with out any interruption, ideally time required for 1005 * the controller to send the dump is 8 seconds. let us 1006 * start timer to handle this asynchronous activity. 1007 */ 1008 clear_bit(QCA_IBS_ENABLED, &qca->flags); 1009 set_bit(QCA_MEMDUMP_COLLECTION, &qca->flags); 1010 dump =3D (void *) skb->data; > 1011 dump_size =3D __le32_to_cpu(dump->dump_size); 1012 if (!(dump_size)) { 1013 bt_dev_err(hu->hdev, "Rx invalid memdump size"); 1014 kfree_skb(skb); 1015 return; 1016 } 1017 = 1018 bt_dev_info(hu->hdev, "QCA collecting dump of size:%u", 1019 dump_size); 1020 mod_timer(&qca->memdump_timer, (jiffies + 1021 msecs_to_jiffies(MEMDUMP_TIMEOUT_MS))); 1022 = 1023 skb_pull(skb, sizeof(dump_size)); 1024 memdump_buf =3D vmalloc(dump_size); 1025 qca_memdump->memdump_buf_head =3D memdump_buf; 1026 qca_memdump->memdump_buf_tail =3D memdump_buf; 1027 } 1028 = 1029 memdump_buf =3D qca_memdump->memdump_buf_tail; 1030 = 1031 /* If sequence no 0 is missed then there is no point in 1032 * accepting the other sequences. 1033 */ 1034 if (!memdump_buf) { 1035 bt_dev_err(hu->hdev, "QCA: Discarding other packets"); 1036 kfree(qca_memdump); 1037 kfree_skb(skb); 1038 qca->qca_memdump =3D NULL; 1039 return; 1040 } 1041 = 1042 /* There could be chance of missing some packets from 1043 * the controller. In such cases let us store the dummy 1044 * packets in the buffer. 1045 */ 1046 while ((seq_no > qca_memdump->current_seq_no + 1) && 1047 seq_no !=3D QCA_LAST_SEQUENCE_NUM) { 1048 bt_dev_err(hu->hdev, "QCA controller missed packet:%d", 1049 qca_memdump->current_seq_no); 1050 memcpy(memdump_buf, nullBuff, QCA_DUMP_PACKET_SIZE); 1051 memdump_buf =3D memdump_buf + QCA_DUMP_PACKET_SIZE; 1052 qca_memdump->received_dump +=3D QCA_DUMP_PACKET_SIZE; 1053 qca_memdump->current_seq_no++; 1054 } 1055 = 1056 memcpy(memdump_buf, (unsigned char *) skb->data, skb->len); 1057 memdump_buf =3D memdump_buf + skb->len; 1058 qca_memdump->memdump_buf_tail =3D memdump_buf; 1059 qca_memdump->current_seq_no =3D seq_no + 1; 1060 qca_memdump->received_dump +=3D skb->len; 1061 qca->qca_memdump =3D qca_memdump; 1062 kfree_skb(skb); 1063 if (seq_no =3D=3D QCA_LAST_SEQUENCE_NUM) { 1064 bt_dev_info(hu->hdev, "QCA writing crash dump of size %d bytes", 1065 qca_memdump->received_dump); 1066 memdump_buf =3D qca_memdump->memdump_buf_head; 1067 dev_coredumpv(&hu->serdev->dev, memdump_buf, 1068 qca_memdump->received_dump, GFP_KERNEL); 1069 del_timer(&qca->memdump_timer); 1070 kfree(qca->qca_memdump); 1071 qca->qca_memdump =3D NULL; 1072 qca->memdump_state =3D QCA_MEMDUMP_COLLECTED; 1073 } 1074 } 1075 = 1076 } 1077 = > 1078 int qca_controller_memdump_event(struct hci_dev *hdev, struct sk_buf= f *skb) 1079 { 1080 struct hci_uart *hu =3D hci_get_drvdata(hdev); 1081 struct qca_data *qca =3D hu->priv; 1082 = 1083 skb_queue_tail(&qca->rx_memdump_q, skb); 1084 queue_work(qca->workqueue, &qca->ctrl_memdump_evt); 1085 = 1086 return 0; 1087 } 1088 = --- 0-DAY kernel test infrastructure Open Source Technology Cen= ter https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org Intel Corpor= ation --===============4743769800769570781==--