Crash in mtd_cls_suspend because mtd is NULL.

From: NeilBrown
Date: Thu Feb 02 2012 - 18:51:11 EST

I just tried to suspend my GTA04 (OMAP based mobile phone platform) running
3.3-rc2 and it crashed in mtd_cls_suspend because mtd was NULL.

So for me, it looks like the following patch is a regression.

Is there anything I can do to help find the correct resolution here.

(It has some flash memory but I am not using it at all).


commit 079c985e7a6f4ce60f931cebfdd5ee3c38347e31
Author: Artem Bityutskiy <artem.bityutskiy@xxxxxxxxxxxxxxx>
Date: Fri Dec 30 17:15:59 2011 +0200

mtd: do not use mtd->suspend and mtd->resume directly

Just call the 'mtd_suspend()' and 'mtd_resume()' - they will do nothing
if the operation is not defined.

Signed-off-by: Artem Bityutskiy <artem.bityutskiy@xxxxxxxxxxxxxxx>
Signed-off-by: David Woodhouse <David.Woodhouse@xxxxxxxxx>

diff --git a/drivers/mtd/mtdcore.c b/drivers/mtd/mtdcore.c
index 66494ee..6ae9ca0 100644
--- a/drivers/mtd/mtdcore.c
+++ b/drivers/mtd/mtdcore.c
@@ -119,10 +119,7 @@ static int mtd_cls_suspend(struct device *dev, pm_message_t
struct mtd_info *mtd = dev_get_drvdata(dev);

- if (mtd && mtd->suspend)
- return mtd_suspend(mtd);
- else
- return 0;
+ return mtd_suspend(mtd);

static int mtd_cls_resume(struct device *dev)

Attachment: signature.asc
Description: PGP signature