diff mbox series

[next] rtw88: 8723d: fix incorrect setting of ldo_pwr

Message ID 20200514181329.16292-1-colin.king@canonical.com (mailing list archive)
State Accepted
Commit c5457559b626a10028ebf05419ac4d430cf2945a
Delegated to: Kalle Valo
Headers show
Series [next] rtw88: 8723d: fix incorrect setting of ldo_pwr | expand

Commit Message

Colin King May 14, 2020, 6:13 p.m. UTC
From: Colin Ian King <colin.king@canonical.com>

Currently ldo_pwr has the LDO25 voltage bits set to zero and then
it is overwritten with the new voltage setting. The assignment
looks incorrect, it should be bit-wise or'ing in the new voltage
setting rather than a direct assignment.

Addresses-Coverity: ("Unused value")
Fixes: 1afb5eb7a00d ("rtw88: 8723d: Add cfg_ldo25 to control LDO25")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
 drivers/net/wireless/realtek/rtw88/rtw8723d.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Ping-Ke Shih May 15, 2020, 12:26 a.m. UTC | #1
On Thu, 2020-05-14 at 18:13 +0000, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
> 
> Currently ldo_pwr has the LDO25 voltage bits set to zero and then
> it is overwritten with the new voltage setting. The assignment
> looks incorrect, it should be bit-wise or'ing in the new voltage
> setting rather than a direct assignment.
> 
> Addresses-Coverity: ("Unused value")
> Fixes: 1afb5eb7a00d ("rtw88: 8723d: Add cfg_ldo25 to control LDO25")
> Signed-off-by: Colin Ian King <colin.king@canonical.com>

Thank you for your fix.

Acked-by: Ping-Ke Shih <pkshih@realtek.com>

> ---
>  drivers/net/wireless/realtek/rtw88/rtw8723d.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/net/wireless/realtek/rtw88/rtw8723d.c
> b/drivers/net/wireless/realtek/rtw88/rtw8723d.c
> index b517af417e0e..2c6e417c5bca 100644
> --- a/drivers/net/wireless/realtek/rtw88/rtw8723d.c
> +++ b/drivers/net/wireless/realtek/rtw88/rtw8723d.c
> @@ -561,7 +561,7 @@ static void rtw8723d_cfg_ldo25(struct rtw_dev *rtwdev,
> bool enable)
>  	ldo_pwr = rtw_read8(rtwdev, REG_LDO_EFUSE_CTRL + 3);
>  	if (enable) {
>  		ldo_pwr &= ~BIT_MASK_LDO25_VOLTAGE;
> -		ldo_pwr = (BIT_LDO25_VOLTAGE_V25 << 4) | BIT_LDO25_EN;
> +		ldo_pwr |= (BIT_LDO25_VOLTAGE_V25 << 4) | BIT_LDO25_EN;
>  	} else {
>  		ldo_pwr &= ~BIT_LDO25_EN;
>  	}
> -- 
> 2.25.1
> 
> 
> ------Please consider the environment before printing this e-mail.
Kalle Valo May 18, 2020, 12:17 p.m. UTC | #2
Colin King <colin.king@canonical.com> wrote:

> From: Colin Ian King <colin.king@canonical.com>
> 
> Currently ldo_pwr has the LDO25 voltage bits set to zero and then
> it is overwritten with the new voltage setting. The assignment
> looks incorrect, it should be bit-wise or'ing in the new voltage
> setting rather than a direct assignment.
> 
> Addresses-Coverity: ("Unused value")
> Fixes: 1afb5eb7a00d ("rtw88: 8723d: Add cfg_ldo25 to control LDO25")
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> Acked-by: Ping-Ke Shih <pkshih@realtek.com>

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

c5457559b626 rtw88: 8723d: fix incorrect setting of ldo_pwr
diff mbox series

Patch

diff --git a/drivers/net/wireless/realtek/rtw88/rtw8723d.c b/drivers/net/wireless/realtek/rtw88/rtw8723d.c
index b517af417e0e..2c6e417c5bca 100644
--- a/drivers/net/wireless/realtek/rtw88/rtw8723d.c
+++ b/drivers/net/wireless/realtek/rtw88/rtw8723d.c
@@ -561,7 +561,7 @@  static void rtw8723d_cfg_ldo25(struct rtw_dev *rtwdev, bool enable)
 	ldo_pwr = rtw_read8(rtwdev, REG_LDO_EFUSE_CTRL + 3);
 	if (enable) {
 		ldo_pwr &= ~BIT_MASK_LDO25_VOLTAGE;
-		ldo_pwr = (BIT_LDO25_VOLTAGE_V25 << 4) | BIT_LDO25_EN;
+		ldo_pwr |= (BIT_LDO25_VOLTAGE_V25 << 4) | BIT_LDO25_EN;
 	} else {
 		ldo_pwr &= ~BIT_LDO25_EN;
 	}