summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarek Vasut <marek.vasut@gmail.com>2010-08-12 03:53:55 +0100
committerDavid Woodhouse <David.Woodhouse@intel.com>2010-08-12 12:17:36 +0100
commit01cd2ababddd55a127caa1cd20d570637e0d42e1 (patch)
tree34d555d43eb53faeaf6426afbe8f1d775c8cff23
parentef56609f9c7fdf5baa9d9f86f84a7bd8a717cd25 (diff)
downloadlinux-01cd2ababddd55a127caa1cd20d570637e0d42e1.tar.gz
linux-01cd2ababddd55a127caa1cd20d570637e0d42e1.tar.bz2
linux-01cd2ababddd55a127caa1cd20d570637e0d42e1.zip
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)
struct resource *res;
int err = 0;
+ if (pdata->chip.nr_chips < 1) {
+ dev_err(&pdev->dev, "invalid number of chips specified\n");
+ return -EINVAL;
+ }
+
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
if (!res)
return -ENXIO;