@@ -957,8 +957,10 @@ static int btintel_pcie_recv_event(struct hci_dev *hdev, struct sk_buff *skb)
957957 /* This is a debug event that comes from IML and OP image when it
958958 * starts execution. There is no need pass this event to stack.
959959 */
960- if (skb -> data [2 ] == 0x97 )
960+ if (skb -> data [2 ] == 0x97 ) {
961+ hci_recv_diag (hdev , skb );
961962 return 0 ;
963+ }
962964 }
963965
964966 return hci_recv_frame (hdev , skb );
@@ -974,7 +976,6 @@ static int btintel_pcie_recv_frame(struct btintel_pcie_data *data,
974976 u8 pkt_type ;
975977 u16 plen ;
976978 u32 pcie_pkt_type ;
977- struct sk_buff * new_skb ;
978979 void * pdata ;
979980 struct hci_dev * hdev = data -> hdev ;
980981
@@ -1051,24 +1052,20 @@ static int btintel_pcie_recv_frame(struct btintel_pcie_data *data,
10511052
10521053 bt_dev_dbg (hdev , "pkt_type: 0x%2.2x len: %u" , pkt_type , plen );
10531054
1054- new_skb = bt_skb_alloc (plen , GFP_ATOMIC );
1055- if (!new_skb ) {
1056- bt_dev_err (hdev , "Failed to allocate memory for skb of len: %u" ,
1057- skb -> len );
1058- ret = - ENOMEM ;
1059- goto exit_error ;
1060- }
1061-
1062- hci_skb_pkt_type (new_skb ) = pkt_type ;
1063- skb_put_data (new_skb , skb -> data , plen );
1055+ hci_skb_pkt_type (skb ) = pkt_type ;
10641056 hdev -> stat .byte_rx += plen ;
1057+ skb_trim (skb , plen );
10651058
10661059 if (pcie_pkt_type == BTINTEL_PCIE_HCI_EVT_PKT )
1067- ret = btintel_pcie_recv_event (hdev , new_skb );
1060+ ret = btintel_pcie_recv_event (hdev , skb );
10681061 else
1069- ret = hci_recv_frame (hdev , new_skb );
1062+ ret = hci_recv_frame (hdev , skb );
1063+ skb = NULL ; /* skb is freed in the callee */
10701064
10711065exit_error :
1066+ if (skb )
1067+ kfree_skb (skb );
1068+
10721069 if (ret )
10731070 hdev -> stat .err_rx ++ ;
10741071
@@ -1202,8 +1199,6 @@ static void btintel_pcie_rx_work(struct work_struct *work)
12021199 struct btintel_pcie_data * data = container_of (work ,
12031200 struct btintel_pcie_data , rx_work );
12041201 struct sk_buff * skb ;
1205- int err ;
1206- struct hci_dev * hdev = data -> hdev ;
12071202
12081203 if (test_bit (BTINTEL_PCIE_HWEXP_INPROGRESS , & data -> flags )) {
12091204 /* Unlike usb products, controller will not send hardware
@@ -1224,11 +1219,7 @@ static void btintel_pcie_rx_work(struct work_struct *work)
12241219
12251220 /* Process the sk_buf in queue and send to the HCI layer */
12261221 while ((skb = skb_dequeue (& data -> rx_skb_q ))) {
1227- err = btintel_pcie_recv_frame (data , skb );
1228- if (err )
1229- bt_dev_err (hdev , "Failed to send received frame: %d" ,
1230- err );
1231- kfree_skb (skb );
1222+ btintel_pcie_recv_frame (data , skb );
12321223 }
12331224}
12341225
0 commit comments