[ARM] S3C: Do not kmalloc/kfree during inner suspend code.
The PM CRC checking code kmallocs an area to save a set of
CRC values during suspend. This triggers a warning due to the
call of a function that might sleep whilst the system is not
in a valid state to do so.
Move the allocation and free to points in the suspend and resume
process where they can call a function that might-sleep.
Signed-off-by: Ben Dooks <ben-linux@fluff.org>
diff --git a/arch/arm/plat-s3c/pm-check.c b/arch/arm/plat-s3c/pm-check.c
index 183f130..39f2555 100644
--- a/arch/arm/plat-s3c/pm-check.c
+++ b/arch/arm/plat-s3c/pm-check.c
@@ -222,9 +222,21 @@
*/
void s3c_pm_check_restore(void)
{
- if (crcs != NULL) {
+ if (crcs != NULL)
s3c_pm_run_sysram(s3c_pm_runcheck, crcs);
- kfree(crcs);
- crcs = NULL;
- }
}
+
+/**
+ * s3c_pm_check_cleanup() - free memory resources
+ *
+ * Free the resources that where allocated by the suspend
+ * memory check code. We do this separately from the
+ * s3c_pm_check_restore() function as we cannot call any
+ * functions that might sleep during that resume.
+ */
+void s3c_pm_check_cleanup(void)
+{
+ kfree(crcs);
+ crcs = NULL;
+}
+