From 01cd2ababddd55a127caa1cd20d570637e0d42e1 Mon Sep 17 00:00:00 2001 From: Marek Vasut Date: Thu, 12 Aug 2010 03:53:55 +0100 Subject: [PATCH] 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(+) 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) 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; -- 2.11.4.GIT