msm: smem: check if shared memory has been initialized

The shared memory protocol requires that the system bootloader initialize
the shared memory region before Linux boots to prevent race conditions.  As
the shared memory region is a vital part of the system, it is assumed that
dependency is always met.  There exists some corner cases in early target
development where that assumption does not hold.

Add a mechanism to check if the shared memory init assumption was violated
so that appropriate failsafe actions can be taken.

CRs-Fixed: 491395
Change-Id: Ife9bc71a405881f5c2945a8cd937db0f7db7e944
Signed-off-by: Jeffrey Hugo <jhugo@codeaurora.org>
diff --git a/arch/arm/mach-msm/smd.c b/arch/arm/mach-msm/smd.c
index a177593..4649390 100644
--- a/arch/arm/mach-msm/smd.c
+++ b/arch/arm/mach-msm/smd.c
@@ -73,7 +73,6 @@
 #endif
 
 #define MODULE_NAME "msm_smd"
-#define SMEM_VERSION 0x000B
 #define SMD_VERSION 0x00020000
 #define SMSM_SNAPSHOT_CNT 64
 #define SMSM_SNAPSHOT_SIZE ((SMSM_NUM_ENTRIES + 1) * 4)
@@ -3802,6 +3801,9 @@
 {
 	int ret;
 
+	if (!smem_initialized_check())
+		return -ENODEV;
+
 	SMD_INFO("smd probe\n");
 	INIT_WORK(&probe_work, smd_channel_probe_worker);