All of lore.kernel.org
 help / color / mirror / Atom feed
* [bug report] ath11k: report rssi of each chain to mac80211 for QCA6390/WCN6855
@ 2022-05-05 10:25 Dan Carpenter
  2022-05-05 10:32 ` Wen Gong
  0 siblings, 1 reply; 3+ messages in thread
From: Dan Carpenter @ 2022-05-05 10:25 UTC (permalink / raw)
  To: quic_wgong; +Cc: ath11k

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [bug report] ath11k: report rssi of each chain to mac80211 for QCA6390/WCN6855
  2022-05-05 10:25 [bug report] ath11k: report rssi of each chain to mac80211 for QCA6390/WCN6855 Dan Carpenter
@ 2022-05-05 10:32 ` Wen Gong
  2022-05-05 11:05   ` Dan Carpenter
  0 siblings, 1 reply; 3+ messages in thread
From: Wen Gong @ 2022-05-05 10:32 UTC (permalink / raw)
  To: Dan Carpenter; +Cc: ath11k

On 5/5/2022 6:25 PM, Dan Carpenter wrote:
> 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'

yes, it should return 0.

please see this commit:

https://git.kernel.org/pub/scm/linux/kernel/git/kvalo/ath.git/commit/drivers/net/wireless/ath/ath11k?id=7330e1ec9748948177830c6e1a13379835d577f9

ath11k: fix warning of not found station for bssid in message

> 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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [bug report] ath11k: report rssi of each chain to mac80211 for QCA6390/WCN6855
  2022-05-05 10:32 ` Wen Gong
@ 2022-05-05 11:05   ` Dan Carpenter
  0 siblings, 0 replies; 3+ messages in thread
From: Dan Carpenter @ 2022-05-05 11:05 UTC (permalink / raw)
  To: Wen Gong; +Cc: ath11k

On Thu, May 05, 2022 at 06:32:48PM +0800, Wen Gong wrote:
> On 5/5/2022 6:25 PM, Dan Carpenter wrote:
> > 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'
> 
> yes, it should return 0.
> 
> please see this commit:
> 
> https://git.kernel.org/pub/scm/linux/kernel/git/kvalo/ath.git/commit/drivers/net/wireless/ath/ath11k?id=7330e1ec9748948177830c6e1a13379835d577f9
> 
> ath11k: fix warning of not found station for bssid in message
> 

We could silence the warning and make the code more obvious by setting
the "ret = 0;" explicitly or another option would be to add a comment.

regards,
dan carpenter


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

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-05-05 11:05 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-05 10:25 [bug report] ath11k: report rssi of each chain to mac80211 for QCA6390/WCN6855 Dan Carpenter
2022-05-05 10:32 ` Wen Gong
2022-05-05 11:05   ` Dan Carpenter

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.