2024-05-31 23:52:18

by Thorsten Blum

[permalink] [raw]
Subject: [PATCH] Bluetooth: btintel_pcie: Remove unnecessary memset(0) calls

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

Signed-off-by: Thorsten Blum <[email protected]>
---
drivers/bluetooth/btintel_pcie.c | 2 --
1 file changed, 2 deletions(-)

diff --git a/drivers/bluetooth/btintel_pcie.c b/drivers/bluetooth/btintel_pcie.c
index 5b6805d87fcf..237d4b27f5d8 100644
--- a/drivers/bluetooth/btintel_pcie.c
+++ b/drivers/bluetooth/btintel_pcie.c
@@ -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
--
2.45.1



2024-06-01 01:13:05

by bluez.test.bot

[permalink] [raw]
Subject: RE: Bluetooth: btintel_pcie: Remove unnecessary memset(0) calls

This is automated email and please do not reply to this email!

Dear submitter,

Thank you for submitting the patches to the linux bluetooth mailing list.
This is a CI test results with your patch series:
PW Link:https://patchwork.kernel.org/project/bluetooth/list/?series=857876

---Test result---

Test Summary:
CheckPatch PASS 0.46 seconds
GitLint FAIL 0.43 seconds
SubjectPrefix PASS 0.07 seconds
BuildKernel PASS 29.44 seconds
CheckAllWarning PASS 32.63 seconds
CheckSparse PASS 37.72 seconds
CheckSmatch FAIL 36.01 seconds
BuildKernel32 PASS 28.64 seconds
TestRunnerSetup PASS 517.96 seconds
TestRunner_l2cap-tester PASS 20.27 seconds
TestRunner_iso-tester PASS 30.58 seconds
TestRunner_bnep-tester PASS 4.84 seconds
TestRunner_mgmt-tester PASS 111.42 seconds
TestRunner_rfcomm-tester PASS 7.33 seconds
TestRunner_sco-tester PASS 14.95 seconds
TestRunner_ioctl-tester PASS 7.91 seconds
TestRunner_mesh-tester PASS 5.86 seconds
TestRunner_smp-tester PASS 6.90 seconds
TestRunner_userchan-tester PASS 4.96 seconds
IncrementalBuild PASS 27.83 seconds

Details
##############################
Test: GitLint - FAIL
Desc: Run gitlint
Output:
Bluetooth: btintel_pcie: Remove unnecessary memset(0) calls

WARNING: I3 - ignore-body-lines: gitlint will be switching from using Python regex 'match' (match beginning) to 'search' (match anywhere) semantics. Please review your ignore-body-lines.regex option accordingly. To remove this warning, set general.regex-style-search=True. More details: https://jorisroovers.github.io/gitlint/configuration/#regex-style-search
9: B3 Line contains hard tab characters (\t): " /* Allocate full chunk of data buffer for DMA first and do indexing and"
10: B3 Line contains hard tab characters (\t): " * initialization next, so it can be freed easily"
11: B3 Line contains hard tab characters (\t): " */"
12: B3 Line contains hard tab characters (\t): " rxq->buf_v_addr already zeroes out memory, so memset is not needed"
16: B3 Line contains hard tab characters (\t): " /* Allocate full chunk of data buffer for DMA first and do indexing and"
17: B3 Line contains hard tab characters (\t): " * initialization next, so it can be freed easily"
18: B3 Line contains hard tab characters (\t): " */"
19: B3 Line contains hard tab characters (\t): " txq->buf_v_addr already zeroes out memory, so memset is not needed"
##############################
Test: CheckSmatch - FAIL
Desc: Run smatch tool with source
Output:

Segmentation fault (core dumped)
make[4]: *** [scripts/Makefile.build:244: net/bluetooth/hci_core.o] Error 139
make[4]: *** Deleting file 'net/bluetooth/hci_core.o'
make[3]: *** [scripts/Makefile.build:485: net/bluetooth] Error 2
make[2]: *** [scripts/Makefile.build:485: net] Error 2
make[2]: *** Waiting for unfinished jobs....
Segmentation fault (core dumped)
make[4]: *** [scripts/Makefile.build:244: drivers/bluetooth/bcm203x.o] Error 139
make[4]: *** Deleting file 'drivers/bluetooth/bcm203x.o'
make[4]: *** Waiting for unfinished jobs....
Segmentation fault (core dumped)
make[4]: *** [scripts/Makefile.build:244: drivers/bluetooth/bpa10x.o] Error 139
make[4]: *** Deleting file 'drivers/bluetooth/bpa10x.o'
make[3]: *** [scripts/Makefile.build:485: drivers/bluetooth] Error 2
make[2]: *** [scripts/Makefile.build:485: drivers] Error 2
make[1]: *** [/github/workspace/src/src/Makefile:1919: .] Error 2
make: *** [Makefile:240: __sub-make] Error 2


---
Regards,
Linux Bluetooth

2024-06-03 13:04:35

by patchwork-bot+bluetooth

[permalink] [raw]
Subject: Re: [PATCH] Bluetooth: btintel_pcie: Remove unnecessary memset(0) calls

Hello:

This patch was applied to bluetooth/bluetooth-next.git (master)
by Luiz Augusto von Dentz <[email protected]>:

On Sat, 1 Jun 2024 01:51:33 +0200 you wrote:
> 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
>
> [...]

Here is the summary with links:
- Bluetooth: btintel_pcie: Remove unnecessary memset(0) calls
https://git.kernel.org/bluetooth/bluetooth-next/c/c137bc53035c

You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html