[bug report] wifi: ath12k: duplicate checks

Dan Carpenter error27 at gmail.com
Thu Feb 16 06:00:16 PST 2023


Hello Kalle Valo,

The patch d889913205cf: "wifi: ath12k: driver for Qualcomm Wi-Fi 7
devices" from Nov 28, 2022, leads to the following Smatch static
checker warning:

drivers/net/wireless/ath/ath12k/mac.c:5809 ath12k_mac_op_assign_vif_chanctx() warn: 'arvif->vdev_type == 4' 'false' implies 'arvif->vdev_type != 4' is 'true'
drivers/net/wireless/ath/ath12k/dp_rx.c:1369 ath12k_update_per_peer_tx_stats() warn: 'mcs > 11' 'false' implies 'mcs > 11' is 'false'
drivers/net/wireless/ath/ath12k/dp_rx.c:1329 ath12k_update_per_peer_tx_stats() warn: address of 'ppdu_stats->user_stats[user]' is non-NULL

drivers/net/wireless/ath/ath12k/mac.c
    5792 
    5793         if (arvif->vdev_type == WMI_VDEV_TYPE_MONITOR) {

type checked here

    5794                 ret = ath12k_mac_monitor_start(ar);
    5795                 if (ret)
    5796                         goto out;
    5797                 arvif->is_started = true;
    5798                 goto out;
    5799         }
    5800 
    5801         ret = ath12k_mac_vdev_start(arvif, &ctx->def);
    5802         if (ret) {
    5803                 ath12k_warn(ab, "failed to start vdev %i addr %pM on freq %d: %d\n",
    5804                             arvif->vdev_id, vif->addr,
    5805                             ctx->def.chan->center_freq, ret);
    5806                 goto out;
    5807         }
    5808 
--> 5809         if (arvif->vdev_type != WMI_VDEV_TYPE_MONITOR && ar->monitor_vdev_created)
                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
No need to check again

    5810                 ath12k_mac_monitor_start(ar);
    5811 
    5812         arvif->is_started = true;
    5813 
    5814         /* TODO: Setup ps and cts/rts protection */
    5815 
    5816 out:
    5817         mutex_unlock(&ar->conf_mutex);
    5818 
    5819         return ret;
    5820 }

regards,
dan carpenter



More information about the ath12k mailing list