aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarek Vasut <marek.vasut@gmail.com>2010-08-11 22:53:55 -0400
committerDavid Woodhouse <David.Woodhouse@intel.com>2010-08-12 07:17:36 -0400
commit01cd2ababddd55a127caa1cd20d570637e0d42e1 (patch)
tree34d555d43eb53faeaf6426afbe8f1d775c8cff23
parentef56609f9c7fdf5baa9d9f86f84a7bd8a717cd25 (diff)
gen_nand: Test if nr_chips field is valid
Signed-off-by: Marek Vasut <marek.vasut@gmail.com> Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
-rw-r--r--drivers/mtd/nand/plat_nand.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/drivers/mtd/nand/plat_nand.c b/drivers/mtd/nand/plat_nand.c
index 90e143e5ad3e..317aff428e42 100644
--- a/drivers/mtd/nand/plat_nand.c
+++ b/drivers/mtd/nand/plat_nand.c
@@ -37,6 +37,11 @@ static int __devinit plat_nand_probe(struct platform_device *pdev)
37 struct resource *res; 37 struct resource *res;
38 int err = 0; 38 int err = 0;
39 39
40 if (pdata->chip.nr_chips < 1) {
41 dev_err(&pdev->dev, "invalid number of chips specified\n");
42 return -EINVAL;
43 }
44
40 res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 45 res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
41 if (!res) 46 if (!res)
42 return -ENXIO; 47 return -ENXIO;