linux-mediatek.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: Bo.Jiao@mediatek.com
Cc: linux-mediatek@lists.infradead.org
Subject: [bug report] mt76: mt7915: add support for MT7986
Date: Tue, 1 Mar 2022 10:38:18 +0300	[thread overview]
Message-ID: <20220301073818.GA12168@kili> (raw)

Hello Bo Jiao,

The patch 99ad32a4ca3a: "mt76: mt7915: add support for MT7986" from
Feb 9, 2022, leads to the following Smatch static checker warning:

	drivers/net/wireless/mediatek/mt76/mt7915/soc.c:357 mt7986_wmac_adie_thermal_cal()
	error: uninitialized symbol 'data'.

drivers/net/wireless/mediatek/mt76/mt7915/soc.c
    349 static int mt7986_wmac_adie_thermal_cal(struct mt7915_dev *dev, u8 adie)
    350 {
    351         int ret;
    352         u32 data, val;
    353 
    354         ret = mt7986_wmac_adie_efuse_read(dev, adie, MT_ADIE_THADC_ANALOG,
    355                                           &data);
                                                  ^^^^^
    356         if (ret || FIELD_GET(MT_ADIE_ANA_EN_MASK, data)) {
--> 357                 val = FIELD_GET(MT_ADIE_VRPI_SEL_EFUSE_MASK, data);
                                                                     ^^^^
If mt7986_wmac_adie_efuse_read() fails then data is uninitialized.

    358                 ret = mt76_wmac_spi_rmw(dev, adie, MT_ADIE_RG_TOP_THADC_BG,
    359                                         MT_ADIE_VRPI_SEL_CR_MASK,
    360                                         FIELD_PREP(MT_ADIE_VRPI_SEL_CR_MASK, val));
    361                 if (ret)
    362                         return ret;
    363 
    364                 val = FIELD_GET(MT_ADIE_PGA_GAIN_EFUSE_MASK, data);
    365                 ret = mt76_wmac_spi_rmw(dev, adie, MT_ADIE_RG_TOP_THADC,
    366                                         MT_ADIE_PGA_GAIN_MASK,
    367                                         FIELD_PREP(MT_ADIE_PGA_GAIN_MASK, val));
    368                 if (ret)
    369                         return ret;
    370         }
    371 
    372         ret = mt7986_wmac_adie_efuse_read(dev, adie, MT_ADIE_THADC_SLOP,
    373                                           &data);
    374         if (ret || FIELD_GET(MT_ADIE_ANA_EN_MASK, data)) {
    375                 val = FIELD_GET(MT_ADIE_LDO_CTRL_EFUSE_MASK, data);

Same

    376 
    377                 return mt76_wmac_spi_rmw(dev, adie, MT_ADIE_RG_TOP_THADC,
    378                                          MT_ADIE_LDO_CTRL_MASK,
    379                                          FIELD_PREP(MT_ADIE_LDO_CTRL_MASK, val));
    380         }
    381 
    382         return 0;
    383 }

regards,
dan carpenter

_______________________________________________
Linux-mediatek mailing list
Linux-mediatek@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-mediatek

                 reply	other threads:[~2022-03-01  7:38 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=20220301073818.GA12168@kili \
    --to=dan.carpenter@oracle.com \
    --cc=Bo.Jiao@mediatek.com \
    --cc=linux-mediatek@lists.infradead.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;
as well as URLs for NNTP newsgroup(s).