public inbox for linux-wireless@vger.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: sean.wang@mediatek.com
Cc: linux-wireless@vger.kernel.org
Subject: [bug report] mt76: mt7921: add MCU support
Date: Wed, 10 Feb 2021 14:07:09 +0300	[thread overview]
Message-ID: <YCO+XQxBe+3D+dA1@mwanda> (raw)

Hello Sean Wang,

The patch 1c099ab44727: "mt76: mt7921: add MCU support" from Jan 28,
2021, leads to the following static checker warning:

	drivers/net/wireless/mediatek/mt76/mt7921/mcu.c:409 mt7921_mcu_tx_rate_report()
	error: potentially dereferencing uninitialized 'stats'.

drivers/net/wireless/mediatek/mt76/mt7921/mcu.c
   390  static void
   391  mt7921_mcu_tx_rate_report(struct mt7921_dev *dev, struct sk_buff *skb,
   392                            u16 wlan_idx)
   393  {
   394          struct mt7921_mcu_wlan_info_event *wtbl_info =
   395                  (struct mt7921_mcu_wlan_info_event *)(skb->data);
   396          struct rate_info rate = {};
   397          u8 curr_idx = wtbl_info->rate_info.rate_idx;
   398          u16 curr = le16_to_cpu(wtbl_info->rate_info.rate[curr_idx]);
   399          struct mt7921_mcu_peer_cap peer = wtbl_info->peer_cap;
   400          struct mt76_phy *mphy = &dev->mphy;
   401          struct mt7921_sta_stats *stats;
   402          struct mt7921_sta *msta;
   403          struct mt76_wcid *wcid;
   404  
   405          if (wlan_idx >= MT76_N_WCIDS)
   406                  return;
   407          wcid = rcu_dereference(dev->mt76.wcid[wlan_idx]);
   408          if (!wcid) {
   409                  stats->tx_rate = rate;
                        ^^^^^^^^^^^^^^^^^^^^^
Not initialized

   410                  return;
   411          }
   412  
   413          msta = container_of(wcid, struct mt7921_sta, wcid);
   414          stats = &msta->stats;
                ^^^^^^^^^^^^^^^^^^^^

   415  
   416          /* current rate */
   417          mt7921_mcu_tx_rate_parse(mphy, &peer, &rate, curr);
   418          stats->tx_rate = rate;
   419  }

regards,
dan carpenter

                 reply	other threads:[~2021-02-10 11:09 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=YCO+XQxBe+3D+dA1@mwanda \
    --to=dan.carpenter@oracle.com \
    --cc=linux-wireless@vger.kernel.org \
    --cc=sean.wang@mediatek.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox