From dc6c5082f478225b7fbce4216173e6c5b36100b4 Mon Sep 17 00:00:00 2001 From: Angela Stegmaier Date: Tue, 8 Mar 2016 16:45:32 -0600 Subject: GateMP: Fix for hostSupport with GateMPSupportNull 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 --- packages/ti/sdo/ipc/GateMP.c | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/packages/ti/sdo/ipc/GateMP.c b/packages/ti/sdo/ipc/GateMP.c index 79b3efe..fd7a91e 100644 --- a/packages/ti/sdo/ipc/GateMP.c +++ b/packages/ti/sdo/ipc/GateMP.c @@ -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; -- cgit v1.2.3