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>

authored by Marek Vasut and committed by David Woodhouse 01cd2aba ef56609f

+5
+5
drivers/mtd/nand/plat_nand.c
··· 37 37 struct resource *res; 38 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 45 res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 41 46 if (!res) 42 47 return -ENXIO;