Linux-mtd Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: hartleys@visionengravers.com
Cc: Richard Weinberger <richard@nod.at>, linux-mtd@lists.infradead.org
Subject: [bug report] mtd: plat_nand: request memory resource before doing ioremap
Date: Tue, 20 Feb 2018 11:41:15 +0300	[thread overview]
Message-ID: <20180220084115.GA18059@mwanda> (raw)

[  This is really weird that Smatch is complaining about ancient code
   today.  No idea why.  - dan ]

Hello H Hartley Sweeten,

The patch 2d098a725333: "mtd: plat_nand: request memory resource
before doing ioremap" from Oct 19, 2009, leads to the following
static checker warning:

	drivers/mtd/nand/raw/plat_nand.c:100 plat_nand_probe()
	info: return a literal instead of 'err'

drivers/mtd/nand/raw/plat_nand.c
    78  
    79          platform_set_drvdata(pdev, data);
    80  
    81          /* Handle any platform specific setup */
    82          if (pdata->ctrl.probe) {
    83                  err = pdata->ctrl.probe(pdev);
    84                  if (err)
    85                          goto out;
    86          }
    87  
    88          /* Scan to find existence of the device */
    89          err = nand_scan(mtd, pdata->chip.nr_chips);
    90          if (err)
    91                  goto out;
    92  
    93          part_types = pdata->chip.part_probe_types;
    94  
    95          err = mtd_device_parse_register(mtd, part_types, NULL,
    96                                          pdata->chip.partitions,
    97                                          pdata->chip.nr_partitions);
    98  
    99          if (!err)
   100                  return err;
                ^^^^^^^^^^^^^^^^^^^

Ugh...  Success handling.  There seems to be a lot of it in this
subsystem.  :(

   101  
   102          nand_release(mtd);
                             ^^^
This call to nand_release() makes no sense.  It calls unregister but
mtd_device_parse_register() failed.

   103  out:
   104          if (pdata->ctrl.remove)
   105                  pdata->ctrl.remove(pdev);
   106          return err;
   107  }

regards,
dan carpenter

             reply	other threads:[~2018-02-20  8:41 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-02-20  8:41 Dan Carpenter [this message]
2018-02-20  9:07 ` [bug report] mtd: plat_nand: request memory resource before doing ioremap Boris Brezillon
2018-02-20  9:36   ` Dan Carpenter

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=20180220084115.GA18059@mwanda \
    --to=dan.carpenter@oracle.com \
    --cc=hartleys@visionengravers.com \
    --cc=linux-mtd@lists.infradead.org \
    --cc=richard@nod.at \
    /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