component/bt: Unlock reserve of SCN 1 for HFP (backport v3.1)

A cherry-pick of MR !3269
This commit is contained in:
baohongde
2018-09-17 11:01:58 +08:00
parent bfcb673c8e
commit ea3b2716fd

View File

@ -1522,11 +1522,10 @@ UINT8 BTM_AllocateSCN(void)
{ {
UINT8 x; UINT8 x;
BTM_TRACE_DEBUG ("BTM_AllocateSCN\n"); BTM_TRACE_DEBUG ("BTM_AllocateSCN\n");
// stack reserves scn 1 for HFP, HSP we still do the correct way
for (x = 1; x < BTM_MAX_SCN; x++) { for (x = 1; x < BTM_MAX_SCN; x++) {
if (!btm_cb.btm_scn[x]) { if (!btm_cb.btm_scn[x - 1]) {
btm_cb.btm_scn[x] = TRUE; btm_cb.btm_scn[x - 1] = TRUE;
return (x + 1); return x;
} }
} }
return (0); /* No free ports */ return (0); /* No free ports */
@ -1545,10 +1544,7 @@ UINT8 BTM_AllocateSCN(void)
#if (CLASSIC_BT_INCLUDED == TRUE) #if (CLASSIC_BT_INCLUDED == TRUE)
BOOLEAN BTM_TryAllocateSCN(UINT8 scn) BOOLEAN BTM_TryAllocateSCN(UINT8 scn)
{ {
/* Make sure we don't exceed max port range. if (scn >= BTM_MAX_SCN) {
* Stack reserves scn 1 for HFP, HSP we still do the correct way.
*/
if ( (scn >= BTM_MAX_SCN) || (scn == 1) ) {
return FALSE; return FALSE;
} }