b43-dev.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] b43: N-PHY: Fix the update of coef for the PHY revision >= 3case
@ 2021-02-15 12:05 Colin King
  2021-02-15 15:58 ` Larry Finger
  2021-02-15 20:50 ` patchwork-bot+netdevbpf at kernel.org
  0 siblings, 2 replies; 3+ messages in thread
From: Colin King @ 2021-02-15 12:05 UTC (permalink / raw)
  To: Kalle Valo, David S . Miller, Jakub Kicinski,
	Rafał Miłecki, John W . Linville, linux-wireless,
	b43-dev, netdev
  Cc: kernel-janitors, linux-kernel

From: Colin Ian King <colin.king@canonical.com>

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")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
 drivers/net/wireless/broadcom/b43/phy_n.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/wireless/broadcom/b43/phy_n.c b/drivers/net/wireless/broadcom/b43/phy_n.c
index b669dff24b6e..665b737fbb0d 100644
--- a/drivers/net/wireless/broadcom/b43/phy_n.c
+++ b/drivers/net/wireless/broadcom/b43/phy_n.c
@@ -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;
 	}
-- 
2.30.0

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH] b43: N-PHY: Fix the update of coef for the PHY revision >= 3case
  2021-02-15 12:05 [PATCH] b43: N-PHY: Fix the update of coef for the PHY revision >= 3case Colin King
@ 2021-02-15 15:58 ` Larry Finger
  2021-02-15 20:50 ` patchwork-bot+netdevbpf at kernel.org
  1 sibling, 0 replies; 3+ messages in thread
From: Larry Finger @ 2021-02-15 15:58 UTC (permalink / raw)
  To: Colin King, Kalle Valo, David S . Miller, Jakub Kicinski,
	Rafał Miłecki, John W . Linville, linux-wireless,
	b43-dev, netdev
  Cc: kernel-janitors, linux-kernel

On 2/15/21 6:05 AM, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
> 
> 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")
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
>   drivers/net/wireless/broadcom/b43/phy_n.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/net/wireless/broadcom/b43/phy_n.c b/drivers/net/wireless/broadcom/b43/phy_n.c
> index b669dff24b6e..665b737fbb0d 100644
> --- a/drivers/net/wireless/broadcom/b43/phy_n.c
> +++ b/drivers/net/wireless/broadcom/b43/phy_n.c
> @@ -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;
>   	}
> 

Acked-by: Larry Finger <Larry.Finger@lwfinger.net>

Good catch, thanks.

Larry

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH] b43: N-PHY: Fix the update of coef for the PHY revision >= 3case
  2021-02-15 12:05 [PATCH] b43: N-PHY: Fix the update of coef for the PHY revision >= 3case Colin King
  2021-02-15 15:58 ` Larry Finger
@ 2021-02-15 20:50 ` patchwork-bot+netdevbpf at kernel.org
  1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+netdevbpf at kernel.org @ 2021-02-15 20:50 UTC (permalink / raw)
  To: Colin King
  Cc: kvalo, davem, kuba, zajec5, linville, linux-wireless, b43-dev,
	netdev, kernel-janitors, linux-kernel

Hello:

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

On Mon, 15 Feb 2021 12:05:32 +0000 you wrote:
> From: Colin Ian King <colin.king@canonical.com>
> 
> 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
> 
> [...]

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-02-15 20:50 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-15 12:05 [PATCH] b43: N-PHY: Fix the update of coef for the PHY revision >= 3case Colin King
2021-02-15 15:58 ` Larry Finger
2021-02-15 20:50 ` patchwork-bot+netdevbpf at kernel.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).