Skip to contentSkip to conversation

rtw88: 8822c: fix missing brace warning for old compilers

PATCH In review [email protected] 3 participants 4 messages May 22, 2020 – May 29, 2020 Realtek wireless driver (rtw88)

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 rtw88: 8822c: fix missing brace warning for old compilers

From: Yan-Hsuan Chuang <[email protected]>

For older versions of gcc, the array = {0}; will cause warnings:

drivers/net/wireless/realtek/rtw88/rtw8822c.c: In function 'rtw8822c_power_trim':

Quoted 2 lines
Quoted 2 lines

drivers/net/wireless/realtek/rtw88/rtw8822c.c:1039:2: warning:
missing braces around initializer [-Wmissing-braces]

s8 bb_gain[2][8] = {0};
^
drivers/net/wireless/realtek/rtw88/rtw8822c.c:1039:2: warning: (near initialization for 'bb_gain[0]') [-Wmissing-braces]

Fixes 5ad4d8957b69 ("rtw88: set power trim according to efuse PG values")
---
 drivers/net/wireless/realtek/rtw88/rtw8822c.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wireless/realtek/rtw88/rtw8822c.c +1 -1
index 2cf1c1f0a639..c3d72ef611c6 100644
@@ -1037,7 +1037,7 @@ static void rtw8822c_set_power_trim(struct rtw_dev *rtwdev, s8 bb_gain[2][8])
 static void rtw8822c_power_trim(struct rtw_dev *rtwdev)
 {
 	u8 pg_pwr = 0xff, i, path, idx;
-	s8 bb_gain[2][8] = {0};
+	s8 bb_gain[2][8] = {};
 	u16 rf_efuse_2g[3] = {PPG_2GL_TXAB, PPG_2GM_TXAB, PPG_2GH_TXAB};
 	u16 rf_efuse_5g[2][5] = {{PPG_5GL1_TXA, PPG_5GL2_TXA, PPG_5GM1_TXA,
 				  PPG_5GM2_TXA, PPG_5GH1_TXA},
Signature · 1 line
2.17.1
#2 lore raw
Quoted 7 lines · Sebastian Andrzej Siewior
Quoted 3 lines · On 2020-05-22 11:55:21 [+0800], [email protected] wrote:

From: Yan-Hsuan Chuang <[email protected]>

For older versions of gcc, the array = {0}; will cause warnings:

I wouldn't say older. I have here 9.3.0 and it does create the same warning.

Yeah, and usually it's best to specify the exact compiler version. "old" and "new" are very relative terms :)

Signature · 1 line
https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches
#3 lore raw
In reply to [email protected]
Quoted 12 lines · <[email protected]> wrote:

From: Yan-Hsuan Chuang <[email protected]>

For older versions of gcc, the array = {0}; will cause warnings:

drivers/net/wireless/realtek/rtw88/rtw8822c.c: In function 'rtw8822c_power_trim':

Quoted 2 lines
Quoted 2 lines

drivers/net/wireless/realtek/rtw88/rtw8822c.c:1039:2: warning:
missing braces around initializer [-Wmissing-braces]

s8 bb_gain[2][8] = {0};
^
drivers/net/wireless/realtek/rtw88/rtw8822c.c:1039:2: warning: (near initialization for 'bb_gain[0]') [-Wmissing-braces]

Quoted 4 lines
Fixes 5ad4d8957b69 ("rtw88: set power trim according to efuse PG values")

Patch applied to wireless-drivers-next.git, thanks.

4e1a341580f2 rtw88: 8822c: fix missing brace warning for old compilers

Signature · 3 lines
https://patchwork.kernel.org/patch/11564651/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches