From 01cd2ababddd55a127caa1cd20d570637e0d42e1 Mon Sep 17 00:00:00 2001 From: Marek Vasut Date: Thu, 12 Aug 2010 03:53:55 +0100 Subject: gen_nand: Test if nr_chips field is valid Signed-off-by: Marek Vasut Signed-off-by: David Woodhouse --- drivers/mtd/nand/plat_nand.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'drivers/mtd') 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; -- cgit v1.2.3