From mboxrd@z Thu Jan 1 00:00:00 1970 Content-Type: multipart/mixed; boundary="===============4205462771356957531==" MIME-Version: 1.0 From: kernel test robot Subject: [PATCH] coccinelle: misc: fix minmax.cocci warnings Date: Thu, 24 Feb 2022 14:55:16 +0800 Message-ID: <20220224065516.GA37304@71d50d64226e> In-Reply-To: <202202241408.Zy8vwY5X-lkp@intel.com> List-Id: To: kbuild@lists.01.org --===============4205462771356957531== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable CC: kbuild-all(a)lists.01.org BCC: lkp(a)intel.com CC: linux-kernel(a)vger.kernel.org TO: Denis Efremov CC: Julia Lawall CC: Vinod Koul CC: dmaengine(a)vger.kernel.org CC: linux-kernel(a)vger.kernel.org From: kernel test robot drivers/dma/dmatest.c:1033:23-24: WARNING opportunity for max() drivers/dma/dmatest.c:1040:23-24: WARNING opportunity for max() drivers/dma/dmatest.c:1046:22-23: WARNING opportunity for max() drivers/dma/dmatest.c:1050:22-23: WARNING opportunity for max() Check for opencoded min(), max() implementations. Generated patches sometimes require adding a cast to fix compile warning. Warnings/patches scope intentionally limited to a function body. Generated by: scripts/coccinelle/misc/minmax.cocci CC: Denis Efremov Reported-by: kernel test robot Signed-off-by: kernel test robot --- tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git = master head: 23d04328444a8fa0ca060c5e532220dac8e8bc26 commit: 5f66f73b9ff4dcabd4e2405ba9c32e80e02f9408 coccinelle: misc: add minm= ax script :::::: branch date: 11 hours ago :::::: commit date: 10 months ago Please take the patch only if it's a positive warning. Thanks! drivers/dma/dmatest.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) --- a/drivers/dma/dmatest.c +++ b/drivers/dma/dmatest.c @@ -1030,24 +1030,24 @@ static int dmatest_add_channel(struct dm if (dma_has_cap(DMA_MEMCPY, dma_dev->cap_mask)) { if (dmatest =3D=3D 0) { cnt =3D dmatest_add_threads(info, dtc, DMA_MEMCPY); - thread_count +=3D cnt > 0 ? cnt : 0; + thread_count +=3D max(cnt, 0); } } = if (dma_has_cap(DMA_MEMSET, dma_dev->cap_mask)) { if (dmatest =3D=3D 1) { cnt =3D dmatest_add_threads(info, dtc, DMA_MEMSET); - thread_count +=3D cnt > 0 ? cnt : 0; + thread_count +=3D max(cnt, 0); } } = if (dma_has_cap(DMA_XOR, dma_dev->cap_mask)) { cnt =3D dmatest_add_threads(info, dtc, DMA_XOR); - thread_count +=3D cnt > 0 ? cnt : 0; + thread_count +=3D max(cnt, 0); } if (dma_has_cap(DMA_PQ, dma_dev->cap_mask)) { cnt =3D dmatest_add_threads(info, dtc, DMA_PQ); - thread_count +=3D cnt > 0 ? cnt : 0; + thread_count +=3D max(cnt, 0); } = pr_info("Added %u threads using %s\n", --===============4205462771356957531==--