linux-mtd.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: Miquel Raynal <miquel.raynal@bootlin.com>
To: Sascha Hauer <s.hauer@pengutronix.de>
Cc: Dan Carpenter <dan.carpenter@oracle.com>,
	kbuild@lists.01.org, lkp@intel.com, kbuild-all@lists.01.org,
	linux-mtd@lists.infradead.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, 3 Mar 2021 09:34:27 +0100	[thread overview]
Message-ID: <20210303093427.0b701dfe@xps13> (raw)
In-Reply-To: <20210303064013.GK5549@pengutronix.de>

Hi Sascha,

Sascha Hauer <s.hauer@pengutronix.de> wrote on Wed, 3 Mar 2021 07:40:13
+0100:

> 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 nand/next
> > head:   095b4dabff2a929cefd330110c5c578956213188
> > commit: 19877b2c5de809e6f553e158c263b7a8bb65222d [12/20] mtd: nand: fix error 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 <lkp@intel.com>
> > Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
> > 
> > New smatch warnings:
> > drivers/mtd/nand/raw/nand_base.c:1466 nand_prog_page_op() warn: impossible condition '(status < 0) => (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-30  1437  int nand_prog_page_op(struct nand_chip *chip, unsigned int page,
> > 97d90da8a88694 drivers/mtd/nand/nand_base.c     Boris Brezillon 2017-11-30  1438  		      unsigned int offset_in_page, const void *buf,
> > 97d90da8a88694 drivers/mtd/nand/nand_base.c     Boris Brezillon 2017-11-30  1439  		      unsigned int len)
> > 97d90da8a88694 drivers/mtd/nand/nand_base.c     Boris Brezillon 2017-11-30  1440  {
> > 97d90da8a88694 drivers/mtd/nand/nand_base.c     Boris Brezillon 2017-11-30  1441  	struct mtd_info *mtd = nand_to_mtd(chip);
> > 19877b2c5de809 drivers/mtd/nand/raw/nand_base.c Sascha Hauer    2021-02-05  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 ‘nand_status_op’ from incompatible pointer type [-Werror=incompatible-pointer-types]
> 
> I'd rather suggest the following.
> 
> Sascha
> 
> --------------------------------8<---------------------------------
> 
> From ea216bee86618a04ea743fbdb59835c28e92c7c9 Mon Sep 17 00:00:00 2001
> From: Sascha Hauer <s.hauer@pengutronix.de>
> 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 <s.hauer@pengutronix.de>
> ---
>  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_base.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, unsigned int page,
>  				     page);
>  		chip->legacy.write_buf(chip, buf, len);
>  		chip->legacy.cmdfunc(chip, NAND_CMD_PAGEPROG, -1, -1);
> -		status = chip->legacy.waitfunc(chip);
> -		if (status < 0)
> -			return status;
> +		ret = chip->legacy.waitfunc(chip);
> +		if (ret < 0)
> +			return ret;
> +		status = ret;

Yep, LGTM. I edited the commit and pushed -f nand/next. Don't tell
Richard ;-)

Cheers,
Miquèl

______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

           reply	other threads:[~2021-03-03 14:40 UTC|newest]

Thread overview: expand[flat|nested]  mbox.gz  Atom feed
 [parent not found: <20210303064013.GK5549@pengutronix.de>]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210303093427.0b701dfe@xps13 \
    --to=miquel.raynal@bootlin.com \
    --cc=dan.carpenter@oracle.com \
    --cc=kbuild-all@lists.01.org \
    --cc=kbuild@lists.01.org \
    --cc=linux-mtd@lists.infradead.org \
    --cc=lkp@intel.com \
    --cc=s.hauer@pengutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).