Skip to contentSkip to conversation

b43: N-PHY: Fix the update of coef for the PHY revision >= 3case

PATCH Applied Colin King 3 participants 3 messages Feb 15, 2021

Subsystems (4)
lore
Share & tools
lore

Colin King

author
#0 lore raw

PATCH 1/1 b43: N-PHY: Fix the update of coef for the PHY revision >= 3case

From: Colin Ian King <[email protected]>

The documentation for the PHY update [1] states:

Loop 4 times with index i

If PHY Revision >= 3
Copy table[i] to coef[i]
Otherwise
Set coef[i] to 0

the copy of the table to coef is currently implemented the wrong way around, table is being updated from uninitialized values in coeff. Fix this by swapping the assignment around.

[1] https://bcm-v4.sipsolutions.net/802.11/PHY/N/RestoreCal/

Fixes 2f258b74d13c ("b43: N-PHY: implement restoring general configuration")

Addresses-Coverity: ("Uninitialized scalar variable")

---
 drivers/net/wireless/broadcom/b43/phy_n.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wireless/broadcom/b43/phy_n.c +1 -1
index b669dff24b6e..665b737fbb0d 100644
@@ -5311,7 +5311,7 @@ static void b43_nphy_restore_cal(struct b43_wldev *dev)
 
 	for (i = 0; i < 4; i++) {
 		if (dev->phy.rev >= 3)
-			table[i] = coef[i];
+			coef[i] = table[i];
 		else
 			coef[i] = 0;
 	}
Signature · 1 line
2.30.0
Acked-by on v1 1/1
#1 lore raw
Quoted 30 lines · Colin King

From: Colin Ian King <[email protected]>

The documentation for the PHY update [1] states:

Loop 4 times with index i

If PHY Revision >= 3
Copy table[i] to coef[i]
Otherwise
Set coef[i] to 0

the copy of the table to coef is currently implemented the wrong way around, table is being updated from uninitialized values in coeff. Fix this by swapping the assignment around.

[1] https://bcm-v4.sipsolutions.net/802.11/PHY/N/RestoreCal/

Fixes 2f258b74d13c ("b43: N-PHY: implement restoring general configuration")

Addresses-Coverity: ("Uninitialized scalar variable")

---
  drivers/net/wireless/broadcom/b43/phy_n.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wireless/broadcom/b43/phy_n.c +0 -0
index b669dff24b6e..665b737fbb0d 100644

drivers/net/wireless/broadcom/b43/phy_n.c static void b43_nphy_restore_cal(struct b43_wldev *dev) · line 5317

Quoted 8 lines
drivers/net/wireless/broadcom/b43/phy_n.c +1 -1
@@ -5311,7 +5311,7 @@ static void b43_nphy_restore_cal(struct b43_wldev *dev)
 
  	for (i = 0; i < 4; i++) {
  		if (dev->phy.rev >= 3)
-			table[i] = coef[i];
+			coef[i] = table[i];
  		else
  			coef[i] = 0;
  	}

Good catch, thanks.

Larry

#2 lore raw
In reply to Colin King
This patch was applied to netdev/net.git (refs/heads/master):

Hello:

This patch was applied to netdev/net.git (refs/heads/master):

Quoted 4 lines · On Mon, 15 Feb 2021 12:05:32 +0000 you wrote:

From: Colin Ian King <[email protected]>

The documentation for the PHY update [1] states:

Quoted 8 lines

Loop 4 times with index i

If PHY Revision >= 3
Copy table[i] to coef[i]
Otherwise
Set coef[i] to 0

[...]

Here is the summary with links:
- b43: N-PHY: Fix the update of coef for the PHY revision >= 3case

    https://git.kernel.org/netdev/net/c/4773acf3d4b5

You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html