summaryrefslogtreecommitdiffstats
path: root/drivers/mtd
diff options
context:
space:
mode:
authorBoris Brezillon <boris.brezillon@bootlin.com>2018-08-04 22:59:23 +0200
committerMiquel Raynal <miquel.raynal@bootlin.com>2018-10-03 11:12:25 +0200
commit800342de6349b333ef2ab921e590708a43ee4345 (patch)
tree6a79522edebdcbb347fcc7f6836983d40e09a620 /drivers/mtd
parentmtd: rawnand: Make maxchips an unsigned int (diff)
downloadlinux-800342de6349b333ef2ab921e590708a43ee4345.tar.xz
linux-800342de6349b333ef2ab921e590708a43ee4345.zip
mtd: rawnand: Do not treat !maxchips specially in nand_scan_with_ids()
The only reason we were skipping nand_scan_ident() when maxchips == 0 was to make the docg4 to work. Now that this driver is gone we can remove this special case and return an error when maxchips is 0. Suggested-by: Miquel Raynal <miquel.raynal@bootlin.com> Signed-off-by: Boris Brezillon <boris.brezillon@bootlin.com> Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
Diffstat (limited to 'drivers/mtd')
-rw-r--r--drivers/mtd/nand/raw/nand_base.c15
1 files changed, 7 insertions, 8 deletions
diff --git a/drivers/mtd/nand/raw/nand_base.c b/drivers/mtd/nand/raw/nand_base.c
index a7e85127c131..e63dfad8235b 100644
--- a/drivers/mtd/nand/raw/nand_base.c
+++ b/drivers/mtd/nand/raw/nand_base.c
@@ -6722,9 +6722,7 @@ static void nand_detach(struct nand_chip *chip)
/**
* nand_scan_with_ids - [NAND Interface] Scan for the NAND device
* @chip: NAND chip object
- * @maxchips: number of chips to scan for. @nand_scan_ident() will not be run if
- * this parameter is zero (useful for specific drivers that must
- * handle this part of the process themselves, e.g docg4).
+ * @maxchips: number of chips to scan for.
* @ids: optional flash IDs table
*
* This fills out all the uninitialized function pointers with the defaults.
@@ -6736,11 +6734,12 @@ int nand_scan_with_ids(struct nand_chip *chip, unsigned int maxchips,
{
int ret;
- if (maxchips) {
- ret = nand_scan_ident(chip, maxchips, ids);
- if (ret)
- return ret;
- }
+ if (!maxchips)
+ return -EINVAL;
+
+ ret = nand_scan_ident(chip, maxchips, ids);
+ if (ret)
+ return ret;
ret = nand_attach(chip);
if (ret)