[PATCH] [MTD] physmap: only call suspend and resume callbacks if non-NULL

Uwe Kleine-König Uwe.Kleine-Koenig at digi.com
Tue Jul 15 09:14:11 EDT 2008


Signed-off-by: Uwe Kleine-König <Uwe.Kleine-Koenig at digi.com>
---
 drivers/mtd/maps/physmap.c |   12 ++++++++----
 1 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/drivers/mtd/maps/physmap.c b/drivers/mtd/maps/physmap.c
index 183255f..f04061f 100644
--- a/drivers/mtd/maps/physmap.c
+++ b/drivers/mtd/maps/physmap.c
@@ -202,8 +202,10 @@ static int physmap_flash_suspend(struct platform_device *dev, pm_message_t state
 	int ret = 0;
 	int i;
 
-	for (i = 0; i < MAX_RESOURCES && info->mtd[i]; i++)
-		ret |= info->mtd[i]->suspend(info->mtd[i]);
+	for (i = 0; i < MAX_RESOURCES && info->mtd[i]; i++) {
+		if (info->mtd[i]->suspend)
+			ret |= info->mtd[i]->suspend(info->mtd[i]);
+	}
 
 	return ret;
 }
@@ -213,8 +215,10 @@ static int physmap_flash_resume(struct platform_device *dev)
 	struct physmap_flash_info *info = platform_get_drvdata(dev);
 	int i;
 
-	for (i = 0; i < MAX_RESOURCES && info->mtd[i]; i++)
-		info->mtd[i]->resume(info->mtd[i]);
+	for (i = 0; i < MAX_RESOURCES && info->mtd[i]; i++) {
+		if (info->mtd[i]->resume)
+			info->mtd[i]->resume(info->mtd[i]);
+	}
 
 	return 0;
 }
-- 
1.5.6.2




More information about the linux-mtd mailing list