wifi: rtlwifi: 8192de: correct checking of IQK reload
authorPing-Ke Shih <pkshih@realtek.com>
Mon, 1 Aug 2022 11:33:45 +0000 (19:33 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 26 Oct 2022 10:34:38 +0000 (12:34 +0200)
[ Upstream commit 93fbc1ebd978cf408ef5765e9c1630fce9a8621b ]

Since IQK could spend time, we make a cache of IQK result matrix that looks
like iqk_matrix[channel_idx].val[x][y], and we can reload the matrix if we
have made a cache. To determine a cache is made, we check
iqk_matrix[channel_idx].val[0][0].

The initial commit 7274a8c22980 ("rtlwifi: rtl8192de: Merge phy routines")
make a mistake that checks incorrect iqk_matrix[channel_idx].val[0] that
is always true, and this mistake is found by commit ee3db469dd31
("wifi: rtlwifi: remove always-true condition pointed out by GCC 12"), so
I recall the vendor driver to find fix and apply the correctness.

Fixes: 7274a8c22980 ("rtlwifi: rtl8192de: Merge phy routines")
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20220801113345.42016-1-pkshih@realtek.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/net/wireless/realtek/rtlwifi/rtl8192de/phy.c

index 743e38a1aa51183e0bef8b2898ebdc5dceca1746..4d153bd62c53ffd725b4337b4ca8073112dc28d8 100644 (file)
@@ -2386,11 +2386,10 @@ void rtl92d_phy_reload_iqk_setting(struct ieee80211_hw *hw, u8 channel)
                        rtl_dbg(rtlpriv, COMP_SCAN, DBG_LOUD,
                                "Just Read IQK Matrix reg for channel:%d....\n",
                                channel);
-                       _rtl92d_phy_patha_fill_iqk_matrix(hw, true,
-                                       rtlphy->iqk_matrix[
-                                       indexforchannel].value, 0,
-                                       (rtlphy->iqk_matrix[
-                                       indexforchannel].value[0][2] == 0));
+                       if (rtlphy->iqk_matrix[indexforchannel].value[0][0] != 0)
+                               _rtl92d_phy_patha_fill_iqk_matrix(hw, true,
+                                       rtlphy->iqk_matrix[indexforchannel].value, 0,
+                                       rtlphy->iqk_matrix[indexforchannel].value[0][2] == 0);
                        if (IS_92D_SINGLEPHY(rtlhal->version)) {
                                if ((rtlphy->iqk_matrix[
                                        indexforchannel].value[0][4] != 0)