Commit 4b5e33a7 authored by Uwe Kleine-König's avatar Uwe Kleine-König Committed by David Woodhouse

[MTD] physmap: resume already suspended chips on failure to suspend

A nice side effect of this patch is that the return value of
physmap_flash_suspend in the error path is the value of the first failing
suspend callback and not the bitwise OR of all of them.
Signed-off-by: default avatarUwe Kleine-König <Uwe.Kleine-Koenig@digi.com>
Signed-off-by: default avatarDavid Woodhouse <David.Woodhouse@intel.com>
parent 7b249191
...@@ -201,8 +201,19 @@ static int physmap_flash_suspend(struct platform_device *dev, pm_message_t state ...@@ -201,8 +201,19 @@ static int physmap_flash_suspend(struct platform_device *dev, pm_message_t state
int i; int i;
for (i = 0; i < MAX_RESOURCES && info->mtd[i]; i++) for (i = 0; i < MAX_RESOURCES && info->mtd[i]; i++)
if (info->mtd[i]->suspend) if (info->mtd[i]->suspend) {
ret |= info->mtd[i]->suspend(info->mtd[i]); ret = info->mtd[i]->suspend(info->mtd[i]);
if (ret)
goto fail;
}
return 0;
fail:
for (--i; i >= 0; --i)
if (info->mtd[i]->suspend) {
BUG_ON(!info->mtd[i]->resume);
info->mtd[i]->resume(info->mtd[i]);
}
return ret; return ret;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment