linux-mtd.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: Sheng Yong <shengyong1@huawei.com>,
	Boris Brezillon <boris.brezillon@free-electrons.com>
Cc: linux-mtd@lists.infradead.org
Subject: Re: [bug report] UBI: Fastmap: Do not add vol if it already exists
Date: Wed, 26 Oct 2016 11:25:36 +0300	[thread overview]
Message-ID: <20161026082536.GP4418@mwanda> (raw)
In-Reply-To: <58100B0B.3030906@huawei.com>

On Wed, Oct 26, 2016 at 09:46:51AM +0800, Sheng Yong wrote:
> Hi Dan,
> 
> On 10/26/2016 4:46 AM, Dan Carpenter wrote:
> > Hello shengyong,
> > 
> > The patch e96a8a3bb671: "UBI: Fastmap: Do not add vol if it already
> > exists" from May 26, 2015, leads to the following static checker
> > warning:
> > 
> > 	drivers/mtd/ubi/fastmap.c:712 ubi_attach_fastmap()
> > 	warn: PTR_ERR(av) is never (-22)
> > 
> > drivers/mtd/ubi/fastmap.c
> >    703  
> >    704                  av = add_vol(ai, be32_to_cpu(fmvhdr->vol_id),
> >    705                               be32_to_cpu(fmvhdr->used_ebs),
> >    706                               be32_to_cpu(fmvhdr->data_pad),
> >    707                               fmvhdr->vol_type,
> >    708                               be32_to_cpu(fmvhdr->last_eb_bytes));
> >    709  
> >    710                  if (!av)
> >    711                          goto fail_bad;
> >    712                  if (PTR_ERR(av) == -EINVAL) {
> > 
> > av is either -EEXIST or -ENOMEM.  It's never -EINVAL.
> The commit e96a8a3bb671 ("UBI: Fastmap: Do not add vol if it already exists")
> adds a "return ERR_PTR(-EINVAL);" to add_vol(). So I think av could be -EINVAL.
> You mean add_vol should return -EEXIST instead of -EINVAL?
>

Oh, ah.  I'm on linux-next.  Commit de4c455b3e9f ("UBI: factorize code
used to manipulate volumes at attach time") removed the -EINVAL.

It's really Boris to blame for this warning.  I'm not sure what the fix
is.

regards,
dan carpenter

  reply	other threads:[~2016-10-26  8:26 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-10-25 20:46 [bug report] UBI: Fastmap: Do not add vol if it already exists Dan Carpenter
2016-10-26  1:46 ` Sheng Yong
2016-10-26  8:25   ` Dan Carpenter [this message]
2016-10-26  9:23     ` Boris Brezillon
2016-10-26 11:30       ` Sheng Yong
2016-10-26 11:28     ` Sheng Yong

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=20161026082536.GP4418@mwanda \
    --to=dan.carpenter@oracle.com \
    --cc=boris.brezillon@free-electrons.com \
    --cc=linux-mtd@lists.infradead.org \
    --cc=shengyong1@huawei.com \
    /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).