[bug report] wifi: ath12k: Move rx error and defrag functions to wifi7 directory

Dan Carpenter dan.carpenter at linaro.org
Wed Dec 17 23:44:39 PST 2025


Moving stuff makes it show up as a new error.  :/

Hello Pavankumar Nandeshwar,

Commit 6b4954d3f000 ("wifi: ath12k: Move rx error and defrag
functions to wifi7 directory") from Aug 28, 2025 (linux-next), leads
to the following Smatch static checker warning:

	drivers/net/wireless/ath/ath12k/wifi7/dp_rx.c:1242 ath12k_wifi7_dp_rx_frag_h_mpdu()
	warn: missing error code here? 'ath12k_wifi7_dp_rx_h_defrag()' failed. 'ret' = '0'

drivers/net/wireless/ath/ath12k/wifi7/dp_rx.c
    1135 static int ath12k_wifi7_dp_rx_frag_h_mpdu(struct ath12k_pdev_dp *dp_pdev,
    1136                                           struct sk_buff *msdu,
    1137                                           struct hal_reo_dest_ring *ring_desc,
    1138                                           struct hal_rx_desc_data *rx_info)
    1139 {
    1140         struct ath12k_dp *dp = dp_pdev->dp;
    1141         struct ath12k_hal *hal = dp->hal;
    1142         struct ath12k_base *ab = dp->ab;
    1143         struct ath12k_dp_peer *peer;
    1144         struct ath12k_dp_rx_tid *rx_tid;
    1145         struct sk_buff *defrag_skb = NULL;
    1146         u32 peer_id = rx_info->peer_id;
    1147         u16 seqno, frag_no;
    1148         u8 tid = rx_info->tid;
    1149         int ret = 0;
    1150         bool more_frags;
    1151         enum hal_encrypt_type enctype = rx_info->enctype;
    1152 
    1153         frag_no = ath12k_dp_rx_h_frag_no(hal, msdu);
    1154         more_frags = ath12k_dp_rx_h_more_frags(hal, msdu);
    1155         seqno = rx_info->seq_no;
    1156 
    1157         if (!rx_info->seq_ctl_valid || !rx_info->fc_valid ||
    1158             tid > IEEE80211_NUM_TIDS)
    1159                 return -EINVAL;
    1160 
    1161         /* received unfragmented packet in reo
    1162          * exception ring, this shouldn't happen
    1163          * as these packets typically come from
    1164          * reo2sw srngs.
    1165          */
    1166         if (WARN_ON_ONCE(!frag_no && !more_frags))
    1167                 return -EINVAL;
    1168 
    1169         spin_lock_bh(&dp->dp_lock);
    1170         peer = ath12k_dp_peer_find_by_peerid(dp_pdev, peer_id);
    1171         if (!peer) {
    1172                 ath12k_warn(ab, "failed to find the peer to de-fragment received fragment peer_id %d\n",
    1173                             peer_id);
    1174                 ret = -ENOENT;
    1175                 goto out_unlock;
    1176         }
    1177 
    1178         if (!peer->dp_setup_done) {
    1179                 ath12k_warn(ab, "The peer %pM [%d] has uninitialized datapath\n",
    1180                             peer->addr, peer_id);
    1181                 ret = -ENOENT;
    1182                 goto out_unlock;
    1183         }
    1184 
    1185         rx_tid = &peer->rx_tid[tid];
    1186 
    1187         if ((!skb_queue_empty(&rx_tid->rx_frags) && seqno != rx_tid->cur_sn) ||
    1188             skb_queue_empty(&rx_tid->rx_frags)) {
    1189                 /* Flush stored fragments and start a new sequence */
    1190                 ath12k_wifi7_dp_rx_frags_cleanup(rx_tid, true);
    1191                 rx_tid->cur_sn = seqno;
    1192         }
    1193 
    1194         if (rx_tid->rx_frag_bitmap & BIT(frag_no)) {
    1195                 /* Fragment already present */
    1196                 ret = -EINVAL;
    1197                 goto out_unlock;
    1198         }
    1199 
    1200         if ((!rx_tid->rx_frag_bitmap || frag_no > __fls(rx_tid->rx_frag_bitmap)))
    1201                 __skb_queue_tail(&rx_tid->rx_frags, msdu);
    1202         else
    1203                 ath12k_dp_rx_h_sort_frags(hal, &rx_tid->rx_frags, msdu);
    1204 
    1205         rx_tid->rx_frag_bitmap |= BIT(frag_no);
    1206         if (!more_frags)
    1207                 rx_tid->last_frag_no = frag_no;
    1208 
    1209         if (frag_no == 0) {
    1210                 rx_tid->dst_ring_desc = kmemdup(ring_desc,
    1211                                                 sizeof(*rx_tid->dst_ring_desc),
    1212                                                 GFP_ATOMIC);
    1213                 if (!rx_tid->dst_ring_desc) {
    1214                         ret = -ENOMEM;
    1215                         goto out_unlock;
    1216                 }
    1217         } else {
    1218                 ath12k_wifi7_dp_rx_link_desc_return(dp, &ring_desc->buf_addr_info,
    1219                                                     HAL_WBM_REL_BM_ACT_PUT_IN_IDLE);
    1220         }
    1221 
    1222         if (!rx_tid->last_frag_no ||
    1223             rx_tid->rx_frag_bitmap != GENMASK(rx_tid->last_frag_no, 0)) {
    1224                 mod_timer(&rx_tid->frag_timer, jiffies +
    1225                                                ATH12K_DP_RX_FRAGMENT_TIMEOUT_MS);
    1226                 goto out_unlock;

error code?

    1227         }
    1228 
    1229         spin_unlock_bh(&dp->dp_lock);
    1230         timer_delete_sync(&rx_tid->frag_timer);
    1231         spin_lock_bh(&dp->dp_lock);
    1232 
    1233         peer = ath12k_dp_peer_find_by_peerid(dp_pdev, peer_id);
    1234         if (!peer)
    1235                 goto err_frags_cleanup;

here too

    1236 
    1237         if (!ath12k_wifi7_dp_rx_h_defrag_validate_incr_pn(dp_pdev, rx_tid, enctype))
    1238                 goto err_frags_cleanup;

and here

    1239 
    1240         if (ath12k_wifi7_dp_rx_h_defrag(dp_pdev, peer, rx_tid, &defrag_skb,
    1241                                         enctype, rx_info))
--> 1242                 goto err_frags_cleanup;

here

    1243 
    1244         if (!defrag_skb)
    1245                 goto err_frags_cleanup;

here

    1246 
    1247         if (ath12k_wifi7_dp_rx_h_defrag_reo_reinject(dp, rx_tid, defrag_skb))
    1248                 goto err_frags_cleanup;

err

    1249 
    1250         ath12k_wifi7_dp_rx_frags_cleanup(rx_tid, false);
    1251         goto out_unlock;
    1252 
    1253 err_frags_cleanup:
    1254         dev_kfree_skb_any(defrag_skb);
    1255         ath12k_wifi7_dp_rx_frags_cleanup(rx_tid, true);
    1256 out_unlock:
    1257         spin_unlock_bh(&dp->dp_lock);
    1258         return ret;
    1259 }

regards,
dan carpenter



More information about the ath12k mailing list