From: Simon Horman <simon.horman@corigine.com>
To: Kalle Valo <kvalo@kernel.org>
Cc: Daniel Golle <daniel@makrotopia.org>,
linux-wireless@vger.kernel.org, netdev@vger.kernel.org,
linux-mediatek@lists.infradead.org,
linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org, Felix Fietkau <nbd@nbd.name>,
Lorenzo Bianconi <lorenzo@kernel.org>,
Ryder Lee <ryder.lee@mediatek.com>,
Shayne Chen <shayne.chen@mediatek.com>,
Sean Wang <sean.wang@mediatek.com>,
"David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
Matthias Brugger <matthias.bgg@gmail.com>,
AngeloGioacchino Del Regno
<angelogioacchino.delregno@collabora.com>,
Alexander Couzens <lynxis@fe80.eu>,
Sujuan Chen <sujuan.chen@mediatek.com>,
Bo Jiao <bo.jiao@mediatek.com>,
Nicolas Cavallari <nicolas.cavallari@green-communications.fr>,
Howard Hsu <howard-yh.hsu@mediatek.com>,
MeiChia Chiu <MeiChia.Chiu@mediatek.com>,
Peter Chiu <chui-hao.chiu@mediatek.com>,
Johannes Berg <johannes.berg@intel.com>,
Wang Yufen <wangyufen@huawei.com>, Lorenz Brun <lorenz@brun.one>
Subject: Re: [PATCH] wifi: mt76: mt7915: add support for MT7981
Date: Mon, 15 May 2023 13:26:40 +0200 [thread overview]
Message-ID: <ZGIW8CHEX7iBJqgr@corigine.com> (raw)
In-Reply-To: <87ednhn97d.fsf@kernel.org>
On Mon, May 15, 2023 at 02:08:22PM +0300, Kalle Valo wrote:
> Daniel Golle <daniel@makrotopia.org> writes:
>
> > On Sun, May 14, 2023 at 04:53:43PM +0200, Simon Horman wrote:
> >> On Sat, May 13, 2023 at 03:35:51PM +0200, Daniel Golle wrote:
> >> > From: Alexander Couzens <lynxis@fe80.eu>
> >> >
> >> > Add support for the MediaTek MT7981 SoC which is similar to the MT7986
> >> > but with a newer IP cores and only 2x ARM Cortex-A53 instead of 4x.
> >> > Unlike MT7986 the MT7981 can only connect a single wireless frontend,
> >> > usually MT7976 is used for DBDC.
> >> >
> >> > Signed-off-by: Alexander Couzens <lynxis@fe80.eu>
> >> > Signed-off-by: Daniel Golle <daniel@makrotopia.org>
> >>
> >> ...
> >>
> >> > @@ -489,7 +516,10 @@ static int mt7986_wmac_adie_patch_7976(struct mt7915_dev *dev, u8 adie)
> >> > rg_xo_01 = 0x1d59080f;
> >> > rg_xo_03 = 0x34c00fe0;
> >> > } else {
> >> > - rg_xo_01 = 0x1959f80f;
> >> > + if (is_mt7981(&dev->mt76))
> >> > + rg_xo_01 = 0x1959c80f;
> >> > + else if (is_mt7986(&dev->mt76))
> >> > + rg_xo_01 = 0x1959f80f;
> >>
> >> Hi Daniel,
> >>
> >> rg_xo_01 will be used uninitialised below if we get here
> >> and neither of the conditions above are true.
> >>
> >> Can this occur?
> >
> > No, it cannot occur. Either of is_mt7981() or is_mt7986() will return
> > true, as the driver is bound via one of the two compatibles
> > 'mediatek,mt7986-wmac' or newly added 'mediatek,mt7981-wmac'.
> > Based on that the match_data is either 0x7986 or 0x7981, which is then
> > used as chip_id, which is used by the is_mt7981() and is_mt7986()
> > functions.
>
> But what if later more changes are made, for example a third compatible
> is added? It would be good to add a warning or something else to protect
> that.
>
> And I would not be a surpised if a compiler or static analyser would
> even warn about the uninitialised variable.
FWIIW, gcc-12 [-Wmaybe-uninitialized], clang-16 [-Wsometimes-uninitialized]
and smatch warn about this.
prev parent reply other threads:[~2023-05-15 11:27 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-05-13 13:35 [PATCH] wifi: mt76: mt7915: add support for MT7981 Daniel Golle
2023-05-14 14:53 ` Simon Horman
2023-05-14 16:32 ` Daniel Golle
2023-05-15 11:08 ` Kalle Valo
2023-05-15 11:26 ` Simon Horman [this message]
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=ZGIW8CHEX7iBJqgr@corigine.com \
--to=simon.horman@corigine.com \
--cc=MeiChia.Chiu@mediatek.com \
--cc=angelogioacchino.delregno@collabora.com \
--cc=bo.jiao@mediatek.com \
--cc=chui-hao.chiu@mediatek.com \
--cc=daniel@makrotopia.org \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=howard-yh.hsu@mediatek.com \
--cc=johannes.berg@intel.com \
--cc=kuba@kernel.org \
--cc=kvalo@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mediatek@lists.infradead.org \
--cc=linux-wireless@vger.kernel.org \
--cc=lorenz@brun.one \
--cc=lorenzo@kernel.org \
--cc=lynxis@fe80.eu \
--cc=matthias.bgg@gmail.com \
--cc=nbd@nbd.name \
--cc=netdev@vger.kernel.org \
--cc=nicolas.cavallari@green-communications.fr \
--cc=pabeni@redhat.com \
--cc=ryder.lee@mediatek.com \
--cc=sean.wang@mediatek.com \
--cc=shayne.chen@mediatek.com \
--cc=sujuan.chen@mediatek.com \
--cc=wangyufen@huawei.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;
as well as URLs for NNTP newsgroup(s).