linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] staging: rtl8723au: hal: check BT_Active and BT_State with correct bit pattern
@ 2016-07-14 10:21 Colin King
  2016-07-20 11:36 ` Jes Sorensen
  0 siblings, 1 reply; 2+ messages in thread
From: Colin King @ 2016-07-14 10:21 UTC (permalink / raw)
  To: Larry Finger, Jes Sorensen, Greg Kroah-Hartman,
	Bhaktipriya Shridhar, Bhumika Goyal, Amitoj Kaur Chawla,
	Shivani Bhardwaj, Daniil Leshchev, Ksenija Stanojevic,
	linux-wireless, devel
  Cc: linux-kernel

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

BT_Active and BT_State are being masked with 0x00ffffff so it the subsequent
comparisons with 0xffffffff are therefore a buggy check.  Instead, check them
against 0x00ffffff.

Unfortunately I couldn't find a datasheet or hardware to see if 0xffffffff
is an expected invalid bit pattern that should be checked before BT_Active and
BT_State are masked with 0x00ffffff, so for now, this fix seems like the least
risky approach.

Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
 drivers/staging/rtl8723au/hal/rtl8723a_bt-coexist.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/rtl8723au/hal/rtl8723a_bt-coexist.c b/drivers/staging/rtl8723au/hal/rtl8723a_bt-coexist.c
index bfcbd7a..6989580 100644
--- a/drivers/staging/rtl8723au/hal/rtl8723a_bt-coexist.c
+++ b/drivers/staging/rtl8723au/hal/rtl8723a_bt-coexist.c
@@ -9824,7 +9824,7 @@ void BTDM_CheckBTIdleChange1Ant(struct rtw_adapter *padapter)
 	BT_Polling = rtl8723au_read32(padapter, regBTPolling);
 	RTPRINT(FBT, BT_TRACE, ("[DM][BT], BT_Polling(0x%x) =%x\n", regBTPolling, BT_Polling));
 
-	if (BT_Active == 0xffffffff && BT_State == 0xffffffff && BT_Polling == 0xffffffff)
+	if (BT_Active == 0x00ffffff && BT_State == 0x00ffffff && BT_Polling == 0xffffffff)
 		return;
 	if (BT_Polling == 0)
 		return;
-- 
2.8.1


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

* Re: [PATCH] staging: rtl8723au: hal: check BT_Active and BT_State with correct bit pattern
  2016-07-14 10:21 [PATCH] staging: rtl8723au: hal: check BT_Active and BT_State with correct bit pattern Colin King
@ 2016-07-20 11:36 ` Jes Sorensen
  0 siblings, 0 replies; 2+ messages in thread
From: Jes Sorensen @ 2016-07-20 11:36 UTC (permalink / raw)
  To: Colin King
  Cc: Larry Finger, Greg Kroah-Hartman, Bhaktipriya Shridhar,
	Bhumika Goyal, Amitoj Kaur Chawla, Shivani Bhardwaj,
	Daniil Leshchev, Ksenija Stanojevic, linux-wireless, devel,
	linux-kernel

Colin King <colin.king@canonical.com> writes:
> From: Colin Ian King <colin.king@canonical.com>
>
> BT_Active and BT_State are being masked with 0x00ffffff so it the subsequent
> comparisons with 0xffffffff are therefore a buggy check.  Instead, check them
> against 0x00ffffff.
>
> Unfortunately I couldn't find a datasheet or hardware to see if 0xffffffff
> is an expected invalid bit pattern that should be checked before BT_Active and
> BT_State are masked with 0x00ffffff, so for now, this fix seems like the least
> risky approach.
>
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
>  drivers/staging/rtl8723au/hal/rtl8723a_bt-coexist.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

I don't really know about the BT parts here, since I never did anything
with that part of the chip. Larry probably knows more.

The only question is whether fixing this bug changes behavior that has
unexpected side effects?

Cheers,
Jes

>
> diff --git a/drivers/staging/rtl8723au/hal/rtl8723a_bt-coexist.c b/drivers/staging/rtl8723au/hal/rtl8723a_bt-coexist.c
> index bfcbd7a..6989580 100644
> --- a/drivers/staging/rtl8723au/hal/rtl8723a_bt-coexist.c
> +++ b/drivers/staging/rtl8723au/hal/rtl8723a_bt-coexist.c
> @@ -9824,7 +9824,7 @@ void BTDM_CheckBTIdleChange1Ant(struct rtw_adapter *padapter)
>  	BT_Polling = rtl8723au_read32(padapter, regBTPolling);
>  	RTPRINT(FBT, BT_TRACE, ("[DM][BT], BT_Polling(0x%x) =%x\n", regBTPolling, BT_Polling));
>  
> -	if (BT_Active == 0xffffffff && BT_State == 0xffffffff && BT_Polling == 0xffffffff)
> +	if (BT_Active == 0x00ffffff && BT_State == 0x00ffffff && BT_Polling == 0xffffffff)
>  		return;
>  	if (BT_Polling == 0)
>  		return;

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

end of thread, other threads:[~2016-07-20 11:36 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-07-14 10:21 [PATCH] staging: rtl8723au: hal: check BT_Active and BT_State with correct bit pattern Colin King
2016-07-20 11:36 ` Jes Sorensen

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).