]>
Commit | Line | Data |
---|---|---|
1143c684 SL |
1 | From 7afc8cddb5b15ab7d1075f91c0cce143f6175ca2 Mon Sep 17 00:00:00 2001 |
2 | From: Arnd Bergmann <arnd@arndb.de> | |
3 | Date: Fri, 22 Mar 2019 15:37:02 +0100 | |
4 | Subject: b43: shut up clang -Wuninitialized variable warning | |
5 | ||
6 | [ Upstream commit d825db346270dbceef83b7b750dbc29f1d7dcc0e ] | |
7 | ||
8 | Clang warns about what is clearly a case of passing an uninitalized | |
9 | variable into a static function: | |
10 | ||
11 | drivers/net/wireless/broadcom/b43/phy_lp.c:1852:23: error: variable 'gains' is uninitialized when used here | |
12 | [-Werror,-Wuninitialized] | |
13 | lpphy_papd_cal(dev, gains, 0, 1, 30); | |
14 | ^~~~~ | |
15 | drivers/net/wireless/broadcom/b43/phy_lp.c:1838:2: note: variable 'gains' is declared here | |
16 | struct lpphy_tx_gains gains, oldgains; | |
17 | ^ | |
18 | 1 error generated. | |
19 | ||
20 | However, this function is empty, and its arguments are never evaluated, | |
21 | so gcc in contrast does not warn here. Both compilers behave in a | |
22 | reasonable way as far as I can tell, so we should change the code | |
23 | to avoid the warning everywhere. | |
24 | ||
25 | We could just eliminate the lpphy_papd_cal() function entirely, | |
26 | given that it has had the TODO comment in it for 10 years now | |
27 | and is rather unlikely to ever get done. I'm doing a simpler | |
28 | change here, and just pass the 'oldgains' variable in that has | |
29 | been initialized, based on the guess that this is what was | |
30 | originally meant. | |
31 | ||
32 | Fixes: 2c0d6100da3e ("b43: LP-PHY: Begin implementing calibration & software RFKILL support") | |
33 | Signed-off-by: Arnd Bergmann <arnd@arndb.de> | |
34 | Acked-by: Larry Finger <Larry.Finger@lwfinger.net> | |
35 | Reviewed-by: Nathan Chancellor <natechancellor@gmail.com> | |
36 | Signed-off-by: Kalle Valo <kvalo@codeaurora.org> | |
37 | Signed-off-by: Sasha Levin <sashal@kernel.org> | |
38 | --- | |
39 | drivers/net/wireless/b43/phy_lp.c | 6 +++--- | |
40 | 1 file changed, 3 insertions(+), 3 deletions(-) | |
41 | ||
42 | diff --git a/drivers/net/wireless/b43/phy_lp.c b/drivers/net/wireless/b43/phy_lp.c | |
43 | index 058a9f2320503..55cb07693ae80 100644 | |
44 | --- a/drivers/net/wireless/b43/phy_lp.c | |
45 | +++ b/drivers/net/wireless/b43/phy_lp.c | |
46 | @@ -1834,7 +1834,7 @@ static void lpphy_papd_cal(struct b43_wldev *dev, struct lpphy_tx_gains gains, | |
47 | static void lpphy_papd_cal_txpwr(struct b43_wldev *dev) | |
48 | { | |
49 | struct b43_phy_lp *lpphy = dev->phy.lp; | |
50 | - struct lpphy_tx_gains gains, oldgains; | |
51 | + struct lpphy_tx_gains oldgains; | |
52 | int old_txpctl, old_afe_ovr, old_rf, old_bbmult; | |
53 | ||
54 | lpphy_read_tx_pctl_mode_from_hardware(dev); | |
55 | @@ -1848,9 +1848,9 @@ static void lpphy_papd_cal_txpwr(struct b43_wldev *dev) | |
56 | lpphy_set_tx_power_control(dev, B43_LPPHY_TXPCTL_OFF); | |
57 | ||
58 | if (dev->dev->chip_id == 0x4325 && dev->dev->chip_rev == 0) | |
59 | - lpphy_papd_cal(dev, gains, 0, 1, 30); | |
60 | + lpphy_papd_cal(dev, oldgains, 0, 1, 30); | |
61 | else | |
62 | - lpphy_papd_cal(dev, gains, 0, 1, 65); | |
63 | + lpphy_papd_cal(dev, oldgains, 0, 1, 65); | |
64 | ||
65 | if (old_afe_ovr) | |
66 | lpphy_set_tx_gains(dev, oldgains); | |
67 | -- | |
68 | 2.20.1 | |
69 |