summaryrefslogtreecommitdiff
path: root/drivers/mtd/maps/physmap.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/mtd/maps/physmap.c')
-rw-r--r--drivers/mtd/maps/physmap.c15
1 files changed, 7 insertions, 8 deletions
diff --git a/drivers/mtd/maps/physmap.c b/drivers/mtd/maps/physmap.c
index f00e04efbe28..bc4649a17b9d 100644
--- a/drivers/mtd/maps/physmap.c
+++ b/drivers/mtd/maps/physmap.c
@@ -202,9 +202,8 @@ static int physmap_flash_suspend(struct platform_device *dev, pm_message_t state
int ret = 0;
int i;
- if (info)
- for (i = 0; i < MAX_RESOURCES; i++)
- ret |= info->mtd[i]->suspend(info->mtd[i]);
+ for (i = 0; i < MAX_RESOURCES && info->mtd[i]; i++)
+ ret |= info->mtd[i]->suspend(info->mtd[i]);
return ret;
}
@@ -214,9 +213,9 @@ static int physmap_flash_resume(struct platform_device *dev)
struct physmap_flash_info *info = platform_get_drvdata(dev);
int i;
- if (info)
- for (i = 0; i < MAX_RESOURCES; i++)
- info->mtd[i]->resume(info->mtd[i]);
+ for (i = 0; i < MAX_RESOURCES && info->mtd[i]; i++)
+ info->mtd[i]->resume(info->mtd[i]);
+
return 0;
}
@@ -225,8 +224,8 @@ static void physmap_flash_shutdown(struct platform_device *dev)
struct physmap_flash_info *info = platform_get_drvdata(dev);
int i;
- for (i = 0; i < MAX_RESOURCES; i++)
- if (info && info->mtd[i]->suspend(info->mtd[i]) == 0)
+ for (i = 0; i < MAX_RESOURCES && info->mtd[i]; i++)
+ if (info->mtd[i]->suspend(info->mtd[i]) == 0)
info->mtd[i]->resume(info->mtd[i]);
}
#else