All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: quic_wgong@quicinc.com
Cc: ath11k@lists.infradead.org
Subject: [bug report] ath11k: report rssi of each chain to mac80211 for QCA6390/WCN6855
Date: Thu, 5 May 2022 13:25:34 +0300	[thread overview]
Message-ID: <YnOmHi3JhnFUc3YQ@kili> (raw)

Hello Wen Gong,

The patch b488c766442f: "ath11k: report rssi of each chain to
mac80211 for QCA6390/WCN6855" from Dec 17, 2021, leads to the
following Smatch static checker warning:

	drivers/net/wireless/ath/ath11k/wmi.c:5800 ath11k_wmi_tlv_rssi_chain_parse()
	warn: missing error code here? 'ieee80211_find_sta_by_ifaddr()' failed. 'ret' = '0'

drivers/net/wireless/ath/ath11k/wmi.c
    5755 static int ath11k_wmi_tlv_rssi_chain_parse(struct ath11k_base *ab,
    5756                                            u16 tag, u16 len,
    5757                                            const void *ptr, void *data)
    5758 {
    5759         struct wmi_tlv_fw_stats_parse *parse = data;
    5760         const struct wmi_stats_event *ev = parse->ev;
    5761         struct ath11k_fw_stats *stats = parse->stats;
    5762         struct ath11k *ar;
    5763         struct ath11k_vif *arvif;
    5764         struct ieee80211_sta *sta;
    5765         struct ath11k_sta *arsta;
    5766         const struct wmi_rssi_stats *stats_rssi = (const struct wmi_rssi_stats *)ptr;
    5767         int j, ret = 0;
    5768 
    5769         if (tag != WMI_TAG_RSSI_STATS)
    5770                 return -EPROTO;
    5771 
    5772         rcu_read_lock();
    5773 
    5774         ar = ath11k_mac_get_ar_by_pdev_id(ab, ev->pdev_id);
    5775         stats->stats_id = WMI_REQUEST_RSSI_PER_CHAIN_STAT;
    5776 
    5777         ath11k_dbg(ab, ATH11K_DBG_WMI,
    5778                    "wmi stats vdev id %d mac %pM\n",
    5779                    stats_rssi->vdev_id, stats_rssi->peer_macaddr.addr);
    5780 
    5781         arvif = ath11k_mac_get_arvif(ar, stats_rssi->vdev_id);
    5782         if (!arvif) {
    5783                 ath11k_warn(ab, "not found vif for vdev id %d\n",
    5784                             stats_rssi->vdev_id);
    5785                 ret = -EPROTO;
    5786                 goto exit;
    5787         }
    5788 
    5789         ath11k_dbg(ab, ATH11K_DBG_WMI,
    5790                    "wmi stats bssid %pM vif %pK\n",
    5791                    arvif->bssid, arvif->vif);
    5792 
    5793         sta = ieee80211_find_sta_by_ifaddr(ar->hw,
    5794                                            arvif->bssid,
    5795                                            NULL);
    5796         if (!sta) {
    5797                 ath11k_dbg(ab, ATH11K_DBG_WMI,
    5798                            "not found station of bssid %pM for rssi chain\n",
    5799                            arvif->bssid);
--> 5800                 goto exit;

Should this return an error code or zero?  It's hard for me to tell.
If returning a zero is correct then doing the "ret = 0;" assignment
within 4 (or 5?) lines of the "goto exit;" will silence the warning.

    5801         }
    5802 
    5803         arsta = (struct ath11k_sta *)sta->drv_priv;
    5804 
    5805         BUILD_BUG_ON(ARRAY_SIZE(arsta->chain_signal) >
    5806                      ARRAY_SIZE(stats_rssi->rssi_avg_beacon));
    5807 
    5808         for (j = 0; j < ARRAY_SIZE(arsta->chain_signal); j++) {
    5809                 arsta->chain_signal[j] = stats_rssi->rssi_avg_beacon[j];
    5810                 ath11k_dbg(ab, ATH11K_DBG_WMI,
    5811                            "wmi stats beacon rssi[%d] %d data rssi[%d] %d\n",
    5812                            j,
    5813                            stats_rssi->rssi_avg_beacon[j],
    5814                            j,
    5815                            stats_rssi->rssi_avg_data[j]);
    5816         }
    5817 
    5818 exit:
    5819         rcu_read_unlock();
    5820         return ret;
    5821 }

regards,
dan carpenter

-- 
ath11k mailing list
ath11k@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/ath11k

             reply	other threads:[~2022-05-05 10:25 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-05 10:25 Dan Carpenter [this message]
2022-05-05 10:32 ` [bug report] ath11k: report rssi of each chain to mac80211 for QCA6390/WCN6855 Wen Gong
2022-05-05 11:05   ` Dan Carpenter

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=YnOmHi3JhnFUc3YQ@kili \
    --to=dan.carpenter@oracle.com \
    --cc=ath11k@lists.infradead.org \
    --cc=quic_wgong@quicinc.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.