diff options
author | John Crispin <blogic@openwrt.org> | 2012-07-22 02:59:57 -0400 |
---|---|---|
committer | David Woodhouse <David.Woodhouse@intel.com> | 2012-09-29 10:01:52 -0400 |
commit | da3888cb84065a03d30b5f729b405e573bd0d66e (patch) | |
tree | e103a9ba2df458630ca330de26fa7936ecccbbf0 /drivers/mtd/nand/plat_nand.c | |
parent | b8c4bf26109878d39b5e6d1425b8c9cd562ef525 (diff) |
mtd: check for valid pdata inside plat_nand
If plat_nand loads and the platform_data is not properly set it will segfault.
Signed-off-by: John Crispin <blogic@openwrt.org>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
Diffstat (limited to 'drivers/mtd/nand/plat_nand.c')
-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 1bcb52040422..a47ee68a0cfa 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 | const char **part_types; | 37 | const char **part_types; |
38 | int err = 0; | 38 | int err = 0; |
39 | 39 | ||
40 | if (!pdata) { | ||
41 | dev_err(&pdev->dev, "platform_nand_data is missing\n"); | ||
42 | return -EINVAL; | ||
43 | } | ||
44 | |||
40 | if (pdata->chip.nr_chips < 1) { | 45 | if (pdata->chip.nr_chips < 1) { |
41 | dev_err(&pdev->dev, "invalid number of chips specified\n"); | 46 | dev_err(&pdev->dev, "invalid number of chips specified\n"); |
42 | return -EINVAL; | 47 | return -EINVAL; |