mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-25 22:23:14 -04:00
qcacmn: Track available ext descriptors in the pool
Check for available ext descriptors before accessing freelist. Change-Id: Iaeea9c7b3b69d14d53bcc23054ebd309b8be2ea9 CRs-Fixed: 2148174
This commit is contained in:
parent
bd894b3bb9
commit
98b30de852
1 changed files with 6 additions and 0 deletions
|
|
@ -368,9 +368,14 @@ struct dp_tx_ext_desc_elem_s *dp_tx_ext_desc_alloc(struct dp_soc *soc,
|
|||
struct dp_tx_ext_desc_elem_s *c_elem;
|
||||
|
||||
TX_DESC_LOCK_LOCK(&soc->tx_ext_desc[desc_pool_id].lock);
|
||||
if (soc->tx_ext_desc[desc_pool_id].num_free <= 0) {
|
||||
TX_DESC_LOCK_UNLOCK(&soc->tx_ext_desc[desc_pool_id].lock);
|
||||
return NULL;
|
||||
}
|
||||
c_elem = soc->tx_ext_desc[desc_pool_id].freelist;
|
||||
soc->tx_ext_desc[desc_pool_id].freelist =
|
||||
soc->tx_ext_desc[desc_pool_id].freelist->next;
|
||||
soc->tx_ext_desc[desc_pool_id].num_free--;
|
||||
TX_DESC_LOCK_UNLOCK(&soc->tx_ext_desc[desc_pool_id].lock);
|
||||
return c_elem;
|
||||
}
|
||||
|
|
@ -389,6 +394,7 @@ static inline void dp_tx_ext_desc_free(struct dp_soc *soc,
|
|||
TX_DESC_LOCK_LOCK(&soc->tx_ext_desc[desc_pool_id].lock);
|
||||
elem->next = soc->tx_ext_desc[desc_pool_id].freelist;
|
||||
soc->tx_ext_desc[desc_pool_id].freelist = elem;
|
||||
soc->tx_ext_desc[desc_pool_id].num_free++;
|
||||
TX_DESC_LOCK_UNLOCK(&soc->tx_ext_desc[desc_pool_id].lock);
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue