Skip to content

Commit

Permalink
Bluetooth: btintel_pcie: Remove unnecessary memset(0) calls
Browse files Browse the repository at this point in the history
Remove memset(0) after dma_alloc_coherent(), which already zeroes out
the memory, and fix the following two Coccinelle/coccicheck warnings
reported by zalloc-simple.cocci:

btintel_pcie.c:837:19-37: WARNING: dma_alloc_coherent used in

	/* Allocate full chunk of data buffer for DMA first and do indexing and
	 * initialization next, so it can be freed easily
	 */
	rxq->buf_v_addr   already zeroes out memory, so memset is not needed

btintel_pcie.c:792:19-37: WARNING: dma_alloc_coherent used in

	/* Allocate full chunk of data buffer for DMA first and do indexing and
	 * initialization next, so it can be freed easily
	 */
	txq->buf_v_addr   already zeroes out memory, so memset is not needed

Fixes: c2b636b ("Bluetooth: btintel_pcie: Add support for PCIe transport")
Signed-off-by: Thorsten Blum <[email protected]>
Signed-off-by: Luiz Augusto von Dentz <[email protected]>
(cherry picked from commit 67c3bceabb42780f18362d7c5ec72a700051ca36)
  • Loading branch information
toblux authored and opsiff committed Dec 3, 2024
1 parent 37c26e9 commit 1720590
Showing 1 changed file with 0 additions and 2 deletions.
2 changes: 0 additions & 2 deletions drivers/bluetooth/btintel_pcie.c
Original file line number Diff line number Diff line change
Expand Up @@ -797,7 +797,6 @@ static int btintel_pcie_setup_txq_bufs(struct btintel_pcie_data *data,
kfree(txq->bufs);
return -ENOMEM;
}
memset(txq->buf_v_addr, 0, txq->count * BTINTEL_PCIE_BUFFER_SIZE);

/* Setup the allocated DMA buffer to bufs. Each data_buf should
* have virtual address and physical address
Expand Down Expand Up @@ -842,7 +841,6 @@ static int btintel_pcie_setup_rxq_bufs(struct btintel_pcie_data *data,
kfree(rxq->bufs);
return -ENOMEM;
}
memset(rxq->buf_v_addr, 0, rxq->count * BTINTEL_PCIE_BUFFER_SIZE);

/* Setup the allocated DMA buffer to bufs. Each data_buf should
* have virtual address and physical address
Expand Down

0 comments on commit 1720590

Please sign in to comment.