platform: msm_shared: NULL pointer check for indices from smem

Add a null pointer check when indices are read from smem in smd
read and write

Change-Id: I990b713e21c0762ada228be7e2e5a1fcb07fb1bb
diff --git a/platform/msm_shared/smd.c b/platform/msm_shared/smd.c
index 61d8f1f..e78b2d4 100644
--- a/platform/msm_shared/smd.c
+++ b/platform/msm_shared/smd.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 2014, The Linux Foundation. All rights reserved.
+/* Copyright (c) 2014-2015, The Linux Foundation. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are
@@ -239,6 +239,12 @@
 	/* Read the indices from smem */
 	ch->port_info = smem_get_alloc_entry(SMEM_SMD_BASE_ID + ch->alloc_entry.cid,
 										 &size);
+	if(!ch->port_info)
+	{
+		dprintf(CRITICAL,"%s: unable to find index in smem\n", __func__);
+		ASSERT(0);
+	}
+
 	if(!ch->port_info->ch1.DTR_DSR)
 	{
 		dprintf(CRITICAL,"%s: DTR is off\n", __func__);
@@ -303,6 +309,11 @@
 	/* Read the indices from smem */
 	ch->port_info = smem_get_alloc_entry(SMEM_SMD_BASE_ID + ch->alloc_entry.cid,
                                                         &size);
+	if(!ch->port_info)
+	{
+		dprintf(CRITICAL,"%s: unable to find index in smem\n", __func__);
+		ASSERT(0);
+	}
 
 	if(!is_channel_open(ch))
 	{