[PATCH] wifi: mt76: mt7996: prevent uninit return in mt7996_mac_sta_add_links
Dan Carpenter
dan.carpenter at linaro.org
Sat Mar 22 03:19:42 PDT 2025
On Sat, Mar 22, 2025 at 11:01:18AM +0100, Markus Elfring wrote:
> …
> > +++ b/drivers/net/wireless/mediatek/mt76/mt7996/main.c
> > @@ -998,16 +998,22 @@ mt7996_mac_sta_add_links(struct mt7996_dev *dev, struct ieee80211_vif *vif,
> > continue;
> >
> > link_conf = link_conf_dereference_protected(vif, link_id);
> > - if (!link_conf)
> > + if (!link_conf) {
> > + err = -EINVAL;
> > goto error_unlink;
> > + }
> >
> > link = mt7996_vif_link(dev, vif, link_id);
> > - if (!link)
> > + if (!link) {
> > + err = -EINVAL;
> > goto error_unlink;
> > + }
> …
>
> I suggest to avoid such repeated error code assignments.
> Can an additional label be applied instead for this purpose?
Maintainers get the final vote but generally when someone is doing
the work they get to decide.
I would say that generally the way that Qasim did it is normally
more readable and more future proof.
regards
dan carpenter
More information about the linux-arm-kernel
mailing list