From mboxrd@z Thu Jan 1 00:00:00 1970 Content-Type: multipart/mixed; boundary="===============5059830569478052754==" MIME-Version: 1.0 From: kernel test robot Subject: [PATCH] mtd: spi-nor: fix minmax.cocci warnings Date: Wed, 09 Feb 2022 05:06:43 +0800 Message-ID: <20220208210642.GA6894@02cc4c783c5e> In-Reply-To: <202202090528.gbvHGW2s-lkp@intel.com> List-Id: To: kbuild@lists.01.org --===============5059830569478052754== 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-arm-kernel(a)lists.infradead.org TO: Amit Kumar Mahapatra CC: Michal Simek CC: Tudor Ambarus CC: Michael Walle CC: Pratyush Yadav CC: Miquel Raynal CC: Richard Weinberger CC: Vignesh Raghavendra CC: linux-mtd(a)lists.infradead.org CC: linux-kernel(a)vger.kernel.org From: kernel test robot drivers/mtd/spi-nor/core.c:2037:10-11: 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 Fixes: 2747bc2106aa ("mtd: spi-nor: Add dual parallel and stacked mode supp= ort") CC: Amit Kumar Mahapatra Reported-by: kernel test robot Signed-off-by: kernel test robot --- tree: https://github.com/Xilinx/linux-xlnx xlnx_rebase_v5.15 head: 1183ce490adb103e5e569b8ebd74c50c885ddc05 commit: 2747bc2106aa429773d9a932c799aa6229595148 [840/872] mtd: spi-nor: Ad= d dual parallel and stacked mode support :::::: branch date: 7 days ago :::::: commit date: 7 days ago Please take the patch only if it's a positive warning. Thanks! core.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) --- a/drivers/mtd/spi-nor/core.c +++ b/drivers/mtd/spi-nor/core.c @@ -2034,10 +2034,7 @@ static int spi_nor_read(struct mtd_info (offset << nor->shift); } } - if (len < rem_bank_len) - read_len =3D len; - else - read_len =3D rem_bank_len; + read_len =3D min(len, rem_bank_len); = /* Wait till previous write/erase is done. */ ret =3D spi_nor_wait_till_ready(nor); --===============5059830569478052754==--