Content-Type: multipart/mixed; boundary="===============4171590856951127995==" MIME-Version: 1.0 From: Sascha Hauer To: kbuild-all@lists.01.org Subject: Re: [mtd:nand/next 12/20] drivers/mtd/nand/raw/nand_base.c:1466 nand_prog_page_op() warn: impossible condition '(status < 0) => (0-255 < 0)' Date: Wed, 03 Mar 2021 07:40:13 +0100 Message-ID: <20210303064013.GK5549@pengutronix.de> In-Reply-To: <20210303055441.GZ2087@kadam> List-Id: --===============4171590856951127995== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable On Wed, Mar 03, 2021 at 08:54:42AM +0300, Dan Carpenter wrote: > tree: https://git.kernel.org/pub/scm/linux/kernel/git/mtd/linux.git nan= d/next > head: 095b4dabff2a929cefd330110c5c578956213188 > commit: 19877b2c5de809e6f553e158c263b7a8bb65222d [12/20] mtd: nand: fix e= rror handling in nand_prog_page_op() #2 > config: x86_64-randconfig-m001-20210302 (attached as .config) > compiler: gcc-9 (Debian 9.3.0-15) 9.3.0 > = > If you fix the issue, kindly add following tag as appropriate > Reported-by: kernel test robot > Reported-by: Dan Carpenter > = > New smatch warnings: > drivers/mtd/nand/raw/nand_base.c:1466 nand_prog_page_op() warn: impossibl= e condition '(status < 0) =3D> (0-255 < 0)' > = > Old smatch warnings: > drivers/mtd/nand/raw/nand_base.c:842 nand_setup_interface() warn: missing= error code 'ret' > = > vim +1466 drivers/mtd/nand/raw/nand_base.c > = > 97d90da8a88694 drivers/mtd/nand/nand_base.c Boris Brezillon 2017-11-3= 0 1437 int nand_prog_page_op(struct nand_chip *chip, unsigned int page, > 97d90da8a88694 drivers/mtd/nand/nand_base.c Boris Brezillon 2017-11-3= 0 1438 unsigned int offset_in_page, const void *buf, > 97d90da8a88694 drivers/mtd/nand/nand_base.c Boris Brezillon 2017-11-3= 0 1439 unsigned int len) > 97d90da8a88694 drivers/mtd/nand/nand_base.c Boris Brezillon 2017-11-3= 0 1440 { > 97d90da8a88694 drivers/mtd/nand/nand_base.c Boris Brezillon 2017-11-3= 0 1441 struct mtd_info *mtd =3D nand_to_mtd(chip); > 19877b2c5de809 drivers/mtd/nand/raw/nand_base.c Sascha Hauer 2021-02-0= 5 1442 u8 status; > = ^^^^^^^^^^ > This needs to be changed to an int &status is passed to nand_status_op(), so this gives us: drivers/mtd/nand/raw/nand_base.c:1457:30: error: passing argument 2 of =E2= =80=98nand_status_op=E2=80=99 from incompatible pointer type [-Werror=3Dinc= ompatible-pointer-types] I'd rather suggest the following. Sascha --------------------------------8<--------------------------------- >From ea216bee86618a04ea743fbdb59835c28e92c7c9 Mon Sep 17 00:00:00 2001 From: Sascha Hauer Date: Wed, 3 Mar 2021 07:32:35 +0100 Subject: [PATCH] fixup! mtd: nand: fix error handling in nand_prog_page_op() #2 Signed-off-by: Sascha Hauer --- drivers/mtd/nand/raw/nand_base.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/mtd/nand/raw/nand_base.c b/drivers/mtd/nand/raw/nand_b= ase.c index 0f6babefaed2..4f263c22c80d 100644 --- a/drivers/mtd/nand/raw/nand_base.c +++ b/drivers/mtd/nand/raw/nand_base.c @@ -1462,9 +1462,10 @@ int nand_prog_page_op(struct nand_chip *chip, unsign= ed int page, page); chip->legacy.write_buf(chip, buf, len); chip->legacy.cmdfunc(chip, NAND_CMD_PAGEPROG, -1, -1); - status =3D chip->legacy.waitfunc(chip); - if (status < 0) - return status; + ret =3D chip->legacy.waitfunc(chip); + if (ret < 0) + return ret; + status =3D ret; } = if (status & NAND_STATUS_FAIL) -- = 2.29.2 -- = Pengutronix e.K. | | Steuerwalder Str. 21 | http://www.pengutronix.de/ | 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 | --===============4171590856951127995==--