From 12844a206de3d543be87b9fbe8af014ca353a974 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=C3=8D=C3=B1igo=20Huguet?= <ihuguet@redhat.com>
Date: Fri, 21 Jan 2022 08:49:04 +0100
Subject: [PATCH 34/36] rtw89: fix maybe-uninitialized error (RHEL only)
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Bugzilla: http://bugzilla.redhat.com/2033291
Upstream-status: RHEL8 only
Fix build error of "maybe uninitialized variable", refering to _cur
variable in rtw8852a.c, function rtw8852a_btc_set_wl_txpwr_ctrl.
In fact it will never be uninitialized in this case because _reg values
used here are within the acceptable range for rtw89_mac_txpwr_read32 so
it will not return an error in this case.
Upstream kernel is built with -Wno-maybe-uninitialized so this warning
does not prevent from building. However, that flag was added after RHEL8
kernel fork, so we build without it.
Signed-off-by: Íñigo Huguet <ihuguet@redhat.com>
---
drivers/net/wireless/realtek/rtw89/rtw8852a.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/net/wireless/realtek/rtw89/rtw8852a.c b/drivers/net/wireless/realtek/rtw89/rtw8852a.c
index 6b75e4bc7352..15337c638317 100644
--- a/drivers/net/wireless/realtek/rtw89/rtw8852a.c
+++ b/drivers/net/wireless/realtek/rtw89/rtw8852a.c
@@ -1806,9 +1806,11 @@ rtw8852a_btc_set_wl_txpwr_ctrl(struct rtw89_dev *rtwdev, u32 txpwr_val)
const u32 _reg = __btc_cr_ ## _case; \
u32 _val = __btc_ctrl_val_ ## _case(txpwr_val); \
u32 _cur, _wrt; \
+ int ret; \
rtw89_debug(rtwdev, RTW89_DBG_TXPWR, \
"btc ctrl %s: 0x%x\n", #_case, _val); \
- rtw89_mac_txpwr_read32(rtwdev, RTW89_PHY_0, _reg, &_cur);\
+ ret = rtw89_mac_txpwr_read32(rtwdev, RTW89_PHY_0, _reg, &_cur);\
+ if (ret) break; \
rtw89_debug(rtwdev, RTW89_DBG_TXPWR, \
"btc ctrl ori 0x%x: 0x%x\n", _reg, _cur); \
_wrt = __do_clr(_val) ? \
--
2.13.6