Search Linux Wireless

Re: [PATCH] wifi: mt76: mt7915: split mcu chan_mib array up

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Il 03/12/22 08:37, Ryder Lee ha scritto:
The current flow confuses coverity check that leads to false reporting,
so split the offs[] into two pieces according to chipset revision to
silence coverity tool.

Signed-off-by: Ryder Lee <ryder.lee@xxxxxxxxxxxx>
---
  .../net/wireless/mediatek/mt76/mt7915/mcu.c   | 50 ++++++++++---------
  1 file changed, 27 insertions(+), 23 deletions(-)

diff --git a/drivers/net/wireless/mediatek/mt76/mt7915/mcu.c b/drivers/net/wireless/mediatek/mt76/mt7915/mcu.c
index b2652de082ba..ca315af3905b 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7915/mcu.c
+++ b/drivers/net/wireless/mediatek/mt76/mt7915/mcu.c
@@ -2974,38 +2974,42 @@ int mt7915_mcu_apply_tx_dpd(struct mt7915_phy *phy)
int mt7915_mcu_get_chan_mib_info(struct mt7915_phy *phy, bool chan_switch)
  {
-	/* strict order */
-	static const u32 offs[] = {
-		MIB_NON_WIFI_TIME,
-		MIB_TX_TIME,
-		MIB_RX_TIME,
-		MIB_OBSS_AIRTIME,
-		MIB_TXOP_INIT_COUNT,
-		/* v2 */
-		MIB_NON_WIFI_TIME_V2,
-		MIB_TX_TIME_V2,
-		MIB_RX_TIME_V2,
-		MIB_OBSS_AIRTIME_V2
-	};
  	struct mt76_channel_state *state = phy->mt76->chan_state;
  	struct mt76_channel_state *state_ts = &phy->state_ts;
  	struct mt7915_dev *dev = phy->dev;
  	struct mt7915_mcu_mib *res, req[5];
  	struct sk_buff *skb;
-	int i, ret, start = 0, ofs = 20;
+	static const u32 *offs;
+	int i, ret, len, offs_cc;
  	u64 cc_tx;

A more readable option would be

	/* strict order */
	static const u32 chip_offs_v1[] = {
		MIB_NON_WIFI_TIME,
		MIB_TX_TIME,
		MIB_RX_TIME,
		MIB_OBSS_AIRTIME,
		MIB_TXOP_INIT_COUNT,
	};

	static const u32 chip_offs_v2[] = {
		MIB_NON_WIFI_TIME_V2,
		MIB_TX_TIME_V2,
		MIB_RX_TIME_V2,
		MIB_OBSS_AIRTIME_V2
	};

	if (is_mt7915(&dev->mt76)) {
		len = ARRAY_SIZE(chip_offs_v1);
		offs = chip_offs_v1;
		offs_cc = 20;
	} else {
		len = ARRAY_SIZE(chip_offs_v2);
		offs = chip_offs_v2;
		offs_cc = 20;
	}

Regards,
Angelo





[Index of Archives]     [Linux Host AP]     [ATH6KL]     [Linux Wireless Personal Area Network]     [Linux Bluetooth]     [Wireless Regulations]     [Linux Netdev]     [Kernel Newbies]     [Linux Kernel]     [IDE]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite Hiking]     [MIPS Linux]     [ARM Linux]     [Linux RAID]

  Powered by Linux