linux-mtd.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] MTD: check for valid pdata inside plat_nand
@ 2012-07-22  6:59 John Crispin
  2012-07-22  6:59 ` [PATCH 2/2] MTD: MIPS: lantiq: Add NAND support on Lantiq XWAY SoC John Crispin
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: John Crispin @ 2012-07-22  6:59 UTC (permalink / raw)
  To: Artem Bityutskiy; +Cc: linux-mtd, John Crispin

If plat_nand loads and the platform_data is not properly set it will segfault.

Signed-off-by: John Crispin <blogic@openwrt.org>
Acked-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
Cc: linux-mtd@lists.infradead.org
---
I am seeing this when plat_nand is referenced inside my DT file but
CONFIG_MTD_NAND_XWAY is not selected, resulting in platform_data not being
populated with valid data.
---
 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 1bcb520..a47ee68 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)
 	const char **part_types;
 	int err = 0;
 
+	if (!pdata) {
+		dev_err(&pdev->dev, "platform_nand_data is missing\n");
+		return -EINVAL;
+	}
+
 	if (pdata->chip.nr_chips < 1) {
 		dev_err(&pdev->dev, "invalid number of chips specified\n");
 		return -EINVAL;
-- 
1.7.9.1

^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2012-08-24 14:26 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-07-22  6:59 [PATCH 1/2] MTD: check for valid pdata inside plat_nand John Crispin
2012-07-22  6:59 ` [PATCH 2/2] MTD: MIPS: lantiq: Add NAND support on Lantiq XWAY SoC John Crispin
2012-07-22  7:07   ` John Crispin
2012-08-15 20:34   ` John Crispin
2012-08-17 14:03 ` [PATCH 1/2] MTD: check for valid pdata inside plat_nand Artem Bityutskiy
2012-08-17 20:52   ` John Crispin
2012-08-24 14:31 ` Artem Bityutskiy

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).