GateMP: Fix for hostSupport with GateMPSupportNull 3.42 ipc-3.42-next 3.42.01.03
authorAngela Stegmaier <angelabaker@ti.com>
Tue, 8 Mar 2016 22:45:32 +0000 (16:45 -0600)
committerAngela Stegmaier <angelabaker@ti.com>
Fri, 11 Mar 2016 19:14:56 +0000 (13:14 -0600)
The default configuration for GateMP remoteCustom2 is to use
GateMPSupportNull. In this case, the remoteCustom2InUse array
will be NULL. Due to this, the virtToPhys translation will
fail. If Asserts are enabled for the GateMP module, this
will result in a failure.

This patch fixes the issue by first checking if the pointer
is NULL before attempting the translation, since it is a valid
case for the pointer to be NULL.

Signed-off-by: Angela Stegmaier <angelabaker@ti.com>
packages/ti/sdo/ipc/GateMP.c

index 79b3efe4e6b76ef17b2dadd3e7c9ca0a343b724f..fd7a91e0804531f3f9a0fa4ed9d43dc5522419dc 100644 (file)
@@ -758,12 +758,22 @@ Void ti_sdo_ipc_GateMP_setRegion0Reserved(Ptr sharedAddr)
             (UInt32)GateMP_module->remoteSystemInUse, &nsValue[0]);
         Assert_isTrue(ret == GateMP_S_SUCCESS, (Assert_Id)NULL);
         (void)ret;   /* silence unused var warning when asserts disabled */
-        ret = _GateMP_virtToPhys(
-            (UInt32)GateMP_module->remoteCustom1InUse, &nsValue[1]);
-        Assert_isTrue(ret == GateMP_S_SUCCESS, (Assert_Id)NULL);
-        ret = _GateMP_virtToPhys(
-            (UInt32)GateMP_module->remoteCustom2InUse, &nsValue[2]);
-        Assert_isTrue(ret == GateMP_S_SUCCESS, (Assert_Id)NULL);
+        if (GateMP_module->numRemoteCustom1 != 0) {
+            ret = _GateMP_virtToPhys(
+                (UInt32)GateMP_module->remoteCustom1InUse, &nsValue[1]);
+            Assert_isTrue(ret == GateMP_S_SUCCESS, (Assert_Id)NULL);
+        }
+        else {
+            nsValue[1] = 0;
+        }
+        if (GateMP_module->numRemoteCustom2 != 0) {
+            ret = _GateMP_virtToPhys(
+                (UInt32)GateMP_module->remoteCustom2InUse, &nsValue[2]);
+            Assert_isTrue(ret == GateMP_S_SUCCESS, (Assert_Id)NULL);
+       }
+        else {
+            nsValue[2] = 0;
+        }
         nsValue[3] = GateMP_module->numRemoteSystem;
         nsValue[4] = GateMP_module->numRemoteCustom1;
         nsValue[5] = GateMP_module->numRemoteCustom2;