diff mbox series

mt76: mt7915: fix code defect

Message ID 5806e90f8e0cf9eba7f5432082a4c0f1e9e15636.1640173851.git.Bo.Jiao@mediatek.com
State New
Headers show
Series mt76: mt7915: fix code defect | expand

Commit Message

Bo Jiao Dec. 22, 2021, 12:29 p.m. UTC
From: Bo Jiao <Bo.Jiao@mediatek.com>

fix code defect, variable 'val' is used without initialization
in mt7915_wfsys_reset().

Signed-off-by: Ryder Lee <ryder.lee@mediatek.com>
Signed-off-by: Bo Jiao <Bo.Jiao@mediatek.com>
---
 drivers/net/wireless/mediatek/mt76/mt7915/init.c | 13 +++++--------
 drivers/net/wireless/mediatek/mt76/mt7915/mmio.c | 14 ++++++--------
 2 files changed, 11 insertions(+), 16 deletions(-)
diff mbox series

Patch

diff --git a/drivers/net/wireless/mediatek/mt76/mt7915/init.c b/drivers/net/wireless/mediatek/mt76/mt7915/init.c
index 7557429..b4ff3d1 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7915/init.c
+++ b/drivers/net/wireless/mediatek/mt76/mt7915/init.c
@@ -541,11 +541,12 @@  static void mt7915_init_work(struct work_struct *work)
 
 static void mt7915_wfsys_reset(struct mt7915_dev *dev)
 {
-	u32 val;
-
 #define MT_MCU_DUMMY_RANDOM	GENMASK(15, 0)
 #define MT_MCU_DUMMY_DEFAULT	GENMASK(31, 16)
+
 	if (is_mt7915(&dev->mt76)) {
+		u32 val = MT_TOP_PWR_KEY | MT_TOP_PWR_SW_PWR_ON | MT_TOP_PWR_PWR_ON;
+
 		mt76_wr(dev, MT_MCU_WFDMA0_DUMMY_CR, MT_MCU_DUMMY_RANDOM);
 
 		/* change to software control */
@@ -578,14 +579,10 @@  static void mt7915_wfsys_reset(struct mt7915_dev *dev)
 
 		msleep(100);
 	} else {
-		val = mt76_rr(dev, MT_WF_SUBSYS_RST);
-
-		val |= 0x1;
-		mt76_wr(dev, MT_WF_SUBSYS_RST, val);
+		mt76_set(dev, MT_WF_SUBSYS_RST, 0x1);
 		msleep(20);
 
-		val &= ~0x1;
-		mt76_wr(dev, MT_WF_SUBSYS_RST, val);
+		mt76_clear(dev, MT_WF_SUBSYS_RST, 0x1);
 		msleep(20);
 	}
 }
diff --git a/drivers/net/wireless/mediatek/mt76/mt7915/mmio.c b/drivers/net/wireless/mediatek/mt76/mt7915/mmio.c
index 6500095..a6dd33f 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7915/mmio.c
+++ b/drivers/net/wireless/mediatek/mt76/mt7915/mmio.c
@@ -271,7 +271,7 @@  static u32 mt7915_reg_map_l1(struct mt7915_dev *dev, u32 addr)
 
 	dev->bus_ops->rmw(&dev->mt76, l1_remap,
 			  MT_HIF_REMAP_L1_MASK,
-		FIELD_PREP(MT_HIF_REMAP_L1_MASK, base));
+			  FIELD_PREP(MT_HIF_REMAP_L1_MASK, base));
 	/* use read to push write */
 	dev->bus_ops->rr(&dev->mt76, l1_remap);
 
@@ -575,17 +575,15 @@  int mt7915_mmio_probe(struct device *pdev,
 	if (ret)
 		goto error;
 
-	if (hif2) {
+	if (hif2 && dev_is_pci(pdev)) {
 		dev->hif2 = hif2;
 
 		mt76_wr(dev, MT_INT1_MASK_CSR, 0);
 		/* master switch of PCIe tnterrupt enable */
-		if (dev_is_pci(pdev)) {
-			if (is_mt7915(mdev))
-				mt76_wr(dev, MT_PCIE1_MAC_INT_ENABLE, 0xff);
-			else
-				mt76_wr(dev, MT_PCIE1_MAC_INT_ENABLE_MT7916, 0xff);
-		}
+		if (is_mt7915(mdev))
+			mt76_wr(dev, MT_PCIE1_MAC_INT_ENABLE, 0xff);
+		else
+			mt76_wr(dev, MT_PCIE1_MAC_INT_ENABLE_MT7916, 0xff);
 
 		ret = devm_request_irq(mdev->dev, dev->hif2->irq,
 				       mt7915_irq_handler, IRQF_SHARED,