public inbox for linux-wireless@vger.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@linaro.org>
To: Lorenzo Bianconi <lorenzo@kernel.org>
Cc: linux-wireless@vger.kernel.org, linux-mediatek@lists.infradead.org
Subject: [bug report] wifi: mt76: mt7996: Rely on mt7996_sta_link in sta_add/sta_remove callbacks
Date: Fri, 21 Mar 2025 17:33:31 +0300	[thread overview]
Message-ID: <f335328d-8554-401b-83c2-36e8d7668a62@stanley.mountain> (raw)

Hello Lorenzo Bianconi,

Commit dd82a9e02c05 ("wifi: mt76: mt7996: Rely on mt7996_sta_link in
sta_add/sta_remove callbacks") from Mar 11, 2025 (linux-next), leads
to the following Smatch static checker warning:

	drivers/net/wireless/mediatek/mt76/mt7996/main.c:1023 mt7996_mac_sta_add_links()
	error: uninitialized symbol 'err'.

drivers/net/wireless/mediatek/mt76/mt7996/main.c
    984 static int
    985 mt7996_mac_sta_add_links(struct mt7996_dev *dev, struct ieee80211_vif *vif,
    986                          struct ieee80211_sta *sta, unsigned long new_links)
    987 {
    988         struct mt7996_sta *msta = (struct mt7996_sta *)sta->drv_priv;
    989         unsigned int link_id;
    990         int err;
    991 
    992         for_each_set_bit(link_id, &new_links, IEEE80211_MLD_MAX_NUM_LINKS) {
    993                 struct ieee80211_bss_conf *link_conf;
    994                 struct ieee80211_link_sta *link_sta;
    995                 struct mt7996_vif_link *link;
    996 
    997                 if (rcu_access_pointer(msta->link[link_id]))
    998                         continue;

What about if there are no new links or we hit the continue on every
iteration.

    999 
    1000                 link_conf = link_conf_dereference_protected(vif, link_id);
    1001                 if (!link_conf)
    1002                         goto error_unlink;

error code?

    1003 
    1004                 link = mt7996_vif_link(dev, vif, link_id);
    1005                 if (!link)
    1006                         goto error_unlink;

error code?

    1007 
    1008                 link_sta = link_sta_dereference_protected(sta, link_id);
    1009                 if (!link_sta)
    1010                         goto error_unlink;

error code?

    1011 
    1012                 err = mt7996_mac_sta_init_link(dev, link_conf, link_sta, link,
    1013                                                link_id);
    1014                 if (err)
    1015                         goto error_unlink;
    1016         }
    1017 
    1018         return 0;
    1019 
    1020 error_unlink:
    1021         mt7996_mac_sta_remove_links(dev, sta, new_links);
    1022 
--> 1023         return err;
    1024 }

regards,
dan carpenter

             reply	other threads:[~2025-03-21 14:33 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-03-21 14:33 Dan Carpenter [this message]
2025-03-21 15:48 ` [bug report] wifi: mt76: mt7996: Rely on mt7996_sta_link in sta_add/sta_remove callbacks Lorenzo Bianconi

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=f335328d-8554-401b-83c2-36e8d7668a62@stanley.mountain \
    --to=dan.carpenter@linaro.org \
    --cc=linux-mediatek@lists.infradead.org \
    --cc=linux-wireless@vger.kernel.org \
    --cc=lorenzo@kernel.org \
    /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