diff options
author | Marek Vasut <marek.vasut@gmail.com> | 2010-08-11 22:53:55 -0400 |
---|---|---|
committer | David Woodhouse <David.Woodhouse@intel.com> | 2010-08-12 07:17:36 -0400 |
commit | 01cd2ababddd55a127caa1cd20d570637e0d42e1 (patch) | |
tree | 34d555d43eb53faeaf6426afbe8f1d775c8cff23 | |
parent | ef56609f9c7fdf5baa9d9f86f84a7bd8a717cd25 (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.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/drivers/mtd/nand/plat_nand.c b/drivers/mtd/nand/plat_nand.c index 90e143e5ad3..317aff428e4 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; |