From mboxrd@z Thu Jan 1 00:00:00 1970 Content-Type: multipart/mixed; boundary="===============3250863030360194851==" MIME-Version: 1.0 From: kernel test robot Subject: [PATCH] coccinelle: misc: fix minmax.cocci warnings Date: Sat, 12 Feb 2022 10:43:19 +0800 Message-ID: <20220212024319.GA49106@27d8fadbd08f> In-Reply-To: <202202121022.hDlOynHu-lkp@intel.com> List-Id: To: kbuild@lists.01.org --===============3250863030360194851== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable CC: kbuild-all(a)lists.01.org CC: linux-kernel(a)vger.kernel.org TO: Denis Efremov CC: Julia Lawall CC: Mark Brown CC: linux-spi(a)vger.kernel.org CC: linux-kernel(a)vger.kernel.org From: kernel test robot drivers/spi/spi-fsl-lpspi.c:446:12-14: WARNING opportunity for min() 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: f1baf68e1383f6ed93eb9cff2866d46562607a43 commit: 5f66f73b9ff4dcabd4e2405ba9c32e80e02f9408 coccinelle: misc: add minm= ax script :::::: branch date: 27 hours ago :::::: commit date: 10 months ago Please take the patch only if it's a positive warning. Thanks! spi-fsl-lpspi.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) --- a/drivers/spi/spi-fsl-lpspi.c +++ b/drivers/spi/spi-fsl-lpspi.c @@ -443,10 +443,7 @@ static int fsl_lpspi_setup_transfer(stru fsl_lpspi->tx =3D fsl_lpspi_buf_tx_u32; } = - if (t->len <=3D fsl_lpspi->txfifosize) - fsl_lpspi->watermark =3D t->len; - else - fsl_lpspi->watermark =3D fsl_lpspi->txfifosize; + fsl_lpspi->watermark =3D min(t->len, fsl_lpspi->txfifosize); = if (fsl_lpspi_can_dma(controller, spi, t)) fsl_lpspi->usedma =3D true; --===============3250863030360194851==--