Bluetooth: btintel_pcie: Remove unnecessary memset(0) calls
authorThorsten Blum <thorsten.blum@toblux.com>
Fri, 31 May 2024 23:51:33 +0000 (01:51 +0200)
committerLuiz Augusto von Dentz <luiz.von.dentz@intel.com>
Mon, 15 Jul 2024 01:34:29 +0000 (21:34 -0400)
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: c2b636b3f788 ("Bluetooth: btintel_pcie: Add support for PCIe transport")
Signed-off-by: Thorsten Blum <thorsten.blum@toblux.com>
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
drivers/bluetooth/btintel_pcie.c

index 58144c82b1cba3d5ab426b210499fbc2b324453b..0d1a0415557b2d3893c64c5b8c39fe5856b8e677 100644 (file)
@@ -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
@@ -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